Skip to content

Instantly share code, notes, and snippets.

@pronto
pronto / headfollow
Last active April 24, 2018 17:20
find where url shorteners go
#!/usr/bin/env python3
#(works for 2.7 as well)
#todo: add support for <script>window.location='nsa.gov'<script>
import requests
import sys
def get_loc(url):
try:
h=requests.head(url).headers['location']
return h
except KeyError:
@pronto
pronto / why.zsh
Created July 12, 2016 14:04
why zsh
#!/usr/bin/env zsh
start=1
start_2=FF
cnt=1
while true;
do
s1=`echo $start | wc -m`
col=`echo $start | sed 's/.//3g'`
col="$col"m
echo -e "$cnt:\e[$col $start"
class ScanIP(Base):
__tablename__='ScanIP'
pk = Column(Integer,Sequence('pk'), primary_key=True)
ip = Column(VARCHAR(39))
class ScanPort(Base):
__tablename__='ScanPort'
pk = Column(Integer,Sequence('pk'), primary_key=True)
ip_pk= Column(Integer, ForeignKey('ScanIP.pk'))
class portscan(Base):
__tablename__ = 'portscan'
pk = Column(Integer,Sequence('pk'), primary_key=True)
ip = Column(VARCHAR(39))
dtime = Column(DATETIME) #because we're keeping a log and gonna update it every so
p21 = Column(Boolean)
p22 = Column(Boolean)
p53 = Column(Boolean)
p80 = Column(Boolean)
p443 = Column(Boolean)
@pronto
pronto / sysinfo snip.c
Created November 19, 2013 19:10
Starting at line 331 of proc/sysinfo.c
static void getrunners(unsigned int *restrict running, unsigned int *restrict blocked) {
struct direct *ent;
DIR *proc;
*running=0;
*blocked=0;
if((proc=opendir("/proc"))==NULL) crash("/proc");
while(( ent=readdir(proc) )) {
// ==UserScript==
// @name Replace Text On Webpages
// @namespace http://userscripts.org/users/23652
// @description Replaces text on websites. Now supports wildcards in search queries. Won't replace text in certain tags like links and code blocks
// @include http://*
// @include https://*
// @exclude http://userscripts.org/scripts/review/*
// @copyright JoeSimmons
// @version 1.0.52
// @license http://creativecommons.org/licenses/by-nc-nd/3.0/us/
@pronto
pronto / spaceapi
Created November 6, 2013 19:11
Space API for tmux output
#! /usr/bin/env python
import simplejson
import urllib2
url="http://www.uasstatus.com/spaceapi.json"
out=urllib2.urlopen(url).read()
json=simplejson.loads(out)
if json['open']== True:
line= "#[fg=green,bold]|{0}|"
else:
line= "#[fg=red]|{0}|"
@pronto
pronto / geo.py
Created March 25, 2015 15:32
geo.py
#!/usr/bin/env python2.7
import sys,re
import geoip2.database
def extractIPs(fileContent):
pattern = r"((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([ (\[]?(\.|dot)[ )\]]?(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})"
ips = [each[0] for each in re.findall(pattern, fileContent)]
for item in ips:
location = ips.index(item)
ip = re.sub("[ ()\[\]]", "", item)
ip = re.sub("dot", ".", ip)
@pronto
pronto / checkit.zsh
Created March 31, 2015 03:19
checker for rsync finish
#!/usr/bin/env zsh
#step one: save this awesome song as "sigtrapdc22.mp3"
# https://soundcloud.com/sigtrap/defcon-22-2014-demo
#then chmod +x this file
#./checkit.zsh ./.filename.ext.thatthingRsynaddsasittranfters
#something like ./.pron.mkv.3M3mTu
while :
do
if [[ ! -a $1 ]]; then
mplayer ~/music/sigtrapdc22.mp3
@pronto
pronto / ipvike.py
Last active August 29, 2015 14:12
python ipviking collector
#!/usr/bin/env python3
#the websocket IP is found in the javascript of the map(if it ever changes)
import asyncio , websockets , json, time , asyncio ,os
@asyncio.coroutine
def hello():
websocket = yield from websockets.connect('ws://64.19.78.244:443/')
while True:
greeting = yield from websocket.recv()
try:
j_v=json.loads(greeting)