Skip to content

Instantly share code, notes, and snippets.

View adi928's full-sized avatar

Aditya Nath adi928

View GitHub Profile
@pry0cc
pry0cc / ports.py
Created October 15, 2020 21:51
Get all ports from an nmap XML output file in the host:ip format
#!/usr/bin/env python
## $ ports.py nmap.xml
## 8.8.8.8:80
## 8.8.8.8:443
## 8.8.8.8:3305
#install requirements: pip install python-libnmap
#uses python 2
@nstarke
nstarke / 0000-cve-2020-8597.md
Last active November 1, 2023 04:48
CVE-2020-8597 - Buffer Overflow in pppd

CVE-2020-8597 - Buffer Overflow in pppd

In this short tutorial we will go over how to reproduce the crash from CVE-2020-8597. This is a stack-based buffer overflow in the pppd binary.

We will use our own pppd binary compiled from source, using the latest version: 2.4.8.

To accomplish this goal, we will need two Virtual Machines connected by a virtual serial port. I typically use VirtualBox since it is open source, but the same sort of configuration should work on other hypervisors.

I spun up two VMs:

@attibalazs
attibalazs / gist:d4c0f9a1d21a0b24ff375690fbb9f9a7
Last active January 13, 2023 09:46
Python functions for creating outlook data files .pst files for archiving emails using win32com.client
# code based on https://mail.python.org/pipermail/python-list/2015-November/698551.html
def find_pst_folder(mapi, pst_filepath):
dispatch = win32com.client.gencache.EnsureDispatch
for store in dispatch(mapi.Stores):
if store.IsDataFileStore and store.FilePath == pst_filepath:
return store.GetRootFolder()
def get_pst_folder(pst_filepath):
@craigbeck
craigbeck / introspection-query.graphql
Created April 6, 2016 20:20
Introspection query for GraphQL
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@luqmaan
luqmaan / write_to_clipboard.py
Last active April 5, 2023 16:35
Write a python string to the clipboard via pbcopy (OS X)
def write_to_clipboard(output):
import subprocess
process = subprocess.Popen('pbcopy', env={'LANG': 'en_US.UTF-8'}, stdin=subprocess.PIPE)
process.communicate(output.encode())
@stevenswafford
stevenswafford / google-dorks
Created June 6, 2015 05:57
Listing of a number of useful Google dorks.
" _ _ "
" _ /|| . . ||\ _ "
" ( } \||D ' ' ' C||/ { % "
" | /\__,=_[_] ' . . ' [_]_=,__/\ |"
" |_\_ |----| |----| _/_|"
" | |/ | | | | \| |"
" | /_ | | | | _\ |"
It is all fun and games until someone gets hacked!
@pokle
pokle / login.html
Created June 4, 2015 06:02
Super simple login form
<!DOCTYPE html>
<html>
<head>
<title>CSSO</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<form class="form" action="/login">
@Wimpje
Wimpje / SplitXml.ps1
Last active February 8, 2023 12:46
Powershell, split large XML files on node name, with offset support
param( [string]$file = $(throw "file is required"), $matchesPerSplit = 50, $maxFiles = [Int32]::MaxValue, $splitOnNode = $(throw "splitOnNode is required"), $offset = 0 )
# with a little help of https://gist.github.com/awayken/5861923
$ErrorActionPreference = "Stop";
trap {
$ErrorActionPreference = "Continue"
write-error "Script failed: $_ \r\n $($_.ScriptStackTrace)"
exit (1);
}
@willurd
willurd / web-servers.md
Last active November 13, 2024 13:44
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000