Skip to content

Instantly share code, notes, and snippets.

@truekonrads
truekonrads / ssh-sftp-and-exec.py
Last active July 13, 2018 03:21
SSH and SFTP within same connection
#!/usr/bin/env python
# While doing IR, we found a log entry which suggested that sftp was open, file was uploaded, but we
# couldn't figure out how it was executed as there wasn't a second login attempt to start the script
# This script explains it.
# Feb 3 15:30:17 kali sshd[5222]: Accepted password for joe from 192.168.61.1 port 28568 ssh2
# Feb 3 15:30:17 kali sshd[5222]: pam_unix(sshd:session): session opened for user joe by (uid=0)
# Feb 3 15:30:17 kali sshd[5227]: subsystem request for sftp by user joe
# Feb 3 15:30:20 kali sshd[5222]: pam_unix(sshd:session): session closed for user joe
@truekonrads
truekonrads / getbulknessus.py
Last active December 6, 2023 23:16
Dump all nessus files as csv from a select folder
#!/usr/bin/env python
# by Konrads Smelkovs <[email protected]>
# Cool contributions by sash
# Licence - CC-BY, else do whatever you want with this
import urllib2
import json
import time
import sys
import argparse
@truekonrads
truekonrads / gnmap-to-http-urls.pl
Created August 5, 2014 12:31
Get http(s) from gnamp and spit out urls
#!/usr/bin/perl -w
# Copyright 2014 Konrads Smelkovs <[email protected]>
#$ cat shooturl.sh
# #!/bin/bash
# /usr/local/bin/CutyCapt --insecure --url=$1 --out=`echo $1|tr '/:' '__'`.png
# Usage: gnmap-to-http-urls.pl scan.gnmap | xargs -P 5 -n 1 --verbose ./shooturl.sh
while (<>) {
next unless m!\d+/open/!;
@truekonrads
truekonrads / whatobj.py
Last active August 29, 2015 14:03
whatobj.py
### THE AMAZING OBJECT IDENTIFIER #####
# By Konrads Smelkovs <[email protected]>
# Math.cos(1);
# x=document.createElement("div")
# Math.atan2(1,"Allocated div");
# x.className="foo";
# Math.sin(1);
# Math.atan(1);
#
#
@truekonrads
truekonrads / brutetftp.py
Created June 27, 2014 21:23
udpchecksumbrute.py
#!/usr/bin/env python
# Solution to DRG Challenge at FIRSTCON 2014
# Two bytes from a UDP packet NUL'ed, need to find them so that checksum matches
import sys
from timeit import timeit
from scapy.all import *
pref="\x00\x03\x00\x01XtG8hI"
targetchecksum=0x808c
#targetchecksum=0x8549
#targetchecksum=0x8555
@truekonrads
truekonrads / webrce.py
Created February 13, 2014 21:58
Web RCE helper
#!/usr/bin/env python
import cmd,urllib2, argparse,urlparse,re,urllib,binascii
DEFAULT_SPLIT=256 # AIX max len is 4k, so we're just shy
def debug(text):
global args
if args.debug:
print "[DD] " + text
class WebRCE(object):
def __init__(self):
@truekonrads
truekonrads / dsts.txt
Last active December 25, 2015 18:39
fake a syn scan
6.7.8.9
2.2.2.2
@truekonrads
truekonrads / aix2john.pl
Last active December 24, 2015 15:39
aix2john
#!/usr/bin/perl -w
#/
# This software is Copyright (c) 2013 Konrads Smelkovs <[email protected]>,
# and it is hereby released to the general public under the following terms:
# Redistribution and use in source and binary forms, with or without
# modification, are permitted.
#
# This script converts AIX /etc/security/passw
# cat /etc/security/passwd
# root:
@truekonrads
truekonrads / getips.pl
Created August 9, 2013 12:16
Read files and stdin and output all IP addresses
#!/usr/bin/perl -wn
@a=split /[^\d.]/;
foreach (@a){
print "$1\n" if m!^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$!;
}
@truekonrads
truekonrads / flow_fuzz.py
Last active December 20, 2015 18:19
simple netflowv9 fuzzer
from sulley import *
from requests import ipfix
sess = sessions.session(session_filename='audits/ipfix.session',proto="udp",log_level=1,sleep_time=0.1)
target = sessions.target('1.2.3.4',2055)
target.netmon = pedrpc.client('127.0.0.1',26001)
sess.add_target(target)
# sess.connect(s_get("flowheader"))