mirror of git://git.acid.vegas/archive.git
Compare commits
7 Commits
e987568dc9
...
76cad6e9e0
Author | SHA1 | Date |
---|---|---|
Dionysus | 76cad6e9e0 | |
Dionysus | 4e3b67ca87 | |
Dionysus | 19597e4bf5 | |
Dionysus | 950b75d56c | |
Dionysus | a82838997f | |
Dionysus | b77c5aed87 | |
Dionysus | ba9f5107ce |
|
@ -1,17 +1,13 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# Tail Bot for syn (cause fuck gh0st and his skid scripts) - Developed by acidvegas in Python (https://git.acid.vegas/archive)
|
# Tail Bot for syn (cause fuck gh0st and his skid scripts) - Developed by acidvegas in Python (https://git.acid.vegas/archive)
|
||||||
|
|
||||||
'''
|
|
||||||
WOAH LOOK NO 3RD PARTY LIBRARIES
|
|
||||||
WOW NO USELESS FUNCTIONS JUST THAT PASS AND ARE DECLARED FOR NO REASON
|
|
||||||
WOW SIMPLE CODE WRITTEN THE CORRECT WAY
|
|
||||||
'''
|
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import aiofiles
|
||||||
import pathlib
|
import pathlib
|
||||||
import ssl
|
import ssl
|
||||||
import time
|
import time
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
import os
|
||||||
|
|
||||||
class connection:
|
class connection:
|
||||||
server = 'irc.supernets.org'
|
server = 'irc.supernets.org'
|
||||||
|
@ -19,7 +15,7 @@ class connection:
|
||||||
ipv6 = False
|
ipv6 = False
|
||||||
ssl = True
|
ssl = True
|
||||||
vhost = None
|
vhost = None
|
||||||
channel = '#honeypot'
|
channel = '#dev'
|
||||||
key = None
|
key = None
|
||||||
modes = None
|
modes = None
|
||||||
|
|
||||||
|
@ -65,18 +61,23 @@ class Bot():
|
||||||
await self.sendmsg(chan, '[{0}] {1} {2}'.format(color('ERROR', red), msg, color(f'({reason})', grey))) if reason else await self.sendmsg(chan, '[{0}] {1}'.format(color('ERROR', red), msg))
|
await self.sendmsg(chan, '[{0}] {1} {2}'.format(color('ERROR', red), msg, color(f'({reason})', grey))) if reason else await self.sendmsg(chan, '[{0}] {1}'.format(color('ERROR', red), msg))
|
||||||
|
|
||||||
async def loop_tail(self):
|
async def loop_tail(self):
|
||||||
if not os.path.exists(FIFO_PATH)
|
if not os.path.exists(FIFO_PATH):
|
||||||
os.mkfifo(FIFO_PATH)
|
os.mkfifo(FIFO_PATH)
|
||||||
while True:
|
while True:
|
||||||
with open(FIFO_PATH) as fifo:
|
async with aiofiles.open(FIFO_PATH) as fifo:
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
self.sendmsg(connection.channel, FIFO_PATH.read_text())
|
log_line = FIFO_PATH.read_text()
|
||||||
|
for line in log_line.splitlines():
|
||||||
|
await self.sendmsg(connection.channel, log_line)
|
||||||
|
await asyncio.sleep(0.1)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
try:
|
try:
|
||||||
self.irc_error(connection.channel, 'Error occured in the loop_tail function!', ex)
|
await self.irc_error(connection.channel, 'Error occured in the loop_tail function!', ex)
|
||||||
|
break
|
||||||
except:
|
except:
|
||||||
error('Fatal error occured in the loop_tail functions!', ex)
|
error('Fatal error occured in the loop_tail functions!', ex)
|
||||||
|
break
|
||||||
|
|
||||||
async def connect(self):
|
async def connect(self):
|
||||||
while True:
|
while True:
|
||||||
|
@ -89,7 +90,7 @@ class Bot():
|
||||||
'family' : 10 if connection.ipv6 else 2,
|
'family' : 10 if connection.ipv6 else 2,
|
||||||
'local_addr' : connection.vhost
|
'local_addr' : connection.vhost
|
||||||
}
|
}
|
||||||
self.reader, self.writer = await asyncio.wait_for(asyncio.open_connection(**options), 15)
|
self.reader, self.writer = await asyncio.wait_for(asyncio.open_connection(**options), 30)
|
||||||
await self.raw(f'USER {identity.username} 0 * :{identity.realname}')
|
await self.raw(f'USER {identity.username} 0 * :{identity.realname}')
|
||||||
await self.raw('NICK ' + identity.nickname)
|
await self.raw('NICK ' + identity.nickname)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
@ -114,12 +115,11 @@ class Bot():
|
||||||
elif args[0] == 'PING':
|
elif args[0] == 'PING':
|
||||||
await self.raw('PONG '+args[1][1:])
|
await self.raw('PONG '+args[1][1:])
|
||||||
elif args[1] == '001':
|
elif args[1] == '001':
|
||||||
|
await asyncio.sleep(5)
|
||||||
if connection.modes:
|
if connection.modes:
|
||||||
await self.raw(f'MODE {identity.nickname} +{connection.modes}')
|
await self.raw(f'MODE {identity.nickname} +{connection.modes}')
|
||||||
if identity.nickserv:
|
if identity.nickserv:
|
||||||
await self.sendmsg('NickServ', f'IDENTIFY {identity.nickname} {identity.nickserv}')
|
await self.sendmsg('NickServ', f'IDENTIFY {identity.nickname} {identity.nickserv}')
|
||||||
if identity.operator:
|
|
||||||
await self.raw('OPER hates {identity.operator}')
|
|
||||||
await self.raw(f'JOIN {connection.channel} {connection.key}') if connection.key else await self.raw('JOIN ' + connection.channel)
|
await self.raw(f'JOIN {connection.channel} {connection.key}') if connection.key else await self.raw('JOIN ' + connection.channel)
|
||||||
self.loops['tail'] = asyncio.create_task(self.loop_tail())
|
self.loops['tail'] = asyncio.create_task(self.loop_tail())
|
||||||
elif args[1] == '433':
|
elif args[1] == '433':
|
||||||
|
|
Loading…
Reference in New Issue