Skip to content

Instantly share code, notes, and snippets.

View Chan9390's full-sized avatar

Chandrapal Badshah Chan9390

View GitHub Profile
@Chan9390
Chan9390 / masscan_parser.py
Last active August 2, 2020 12:45
Python snippet to parse massDNS results
import socket
with open('file.txt', 'r') as f:
t = f.read().split('\n')
for a in range(0, len(t)):
if t[a] != '':
try:
temp = t[a].split(' ')[0][:-1]
ip = socket.gethostbyname(temp)
print temp + ' ' + ip
@Chan9390
Chan9390 / genymotionwithplay.txt
Created January 12, 2018 17:56 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@Chan9390
Chan9390 / mips-cross-compiler.sh
Created July 24, 2018 13:36
Creating MIPS cross compiler for ARM architecture
mkdir crossbuild
cd crossbuild
mkdir gcc
mkdir eglibc
mkdir binutils
mkdir install
mkdir sysroot
export prefix=/home/pi/crossbuild/install
export sysroot=/home/pi/crossbuild/sysroot
@Chan9390
Chan9390 / manage_users.yml
Created October 23, 2018 13:39
Ansible script to manage Linux users and their authorized SSH keys
---
- hosts: production
gather_facts: no # This is helpful if a new EC2 instance is to be provisioned
become: yes
vars:
- default_users: ['nobody']
- required_users: ['badshah', 'bob', 'alice']
tasks:
echo Project Name,Disk Name,Source Image
for projectname in `gcloud projects list --format json | jq -r '.[].projectId'`; do
gcloud compute disks list -q --project $projectname --format json | \
jq -r '.[] | ["\(.name)", "\(.sourceImage)"] | @tsv' | \
while IFS=$'\t' read -r diskname sourceimage; do
os=`echo $sourceimage | awk -F "/" '{print $NF}'`;
echo $projectname,$diskname,$os;
done;
done
@Chan9390
Chan9390 / cloudflare.py
Created June 14, 2019 07:28
Python script to get all DNS records from all Cloudflare zones
import CloudFlare
cf = CloudFlare.CloudFlare()
zones = cf.zones.get()
for zone in zones:
for record in cf.zones.dns_records.get(zone['id'], params={'per_page':100}):
print record['name'] + ',' + record['type'] + ',' + record['content']
{
"mode": "patterns",
"proxySettings": [
{
"address": "127.0.0.1",
"port": 8080,
"username": "",
"password": "",
"type": 1,
"title": "127.0.0.1:8080",
@Chan9390
Chan9390 / gist:d49c0024aa59edb455c0954ec7eefe37
Created February 23, 2020 06:27
One liner to get all the IP ranges of AWS Gov regions
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.region | contains("gov")) | .ip_prefix' | sort -u
@Chan9390
Chan9390 / gist:a3c69ca3a8c9a28d97aa1345f42599c8
Last active March 4, 2020 08:21
Faster nmap scanning with the help of GNU parallel - Part 2
for dirname in logs/*;
do
for filename in ${dirname}/*.gnmap;
do
project=`echo $filename | cut -d/ -f2`;
ip=`echo $filename | cut -d/ -f3`;
ip=${ip::-6};
cat $filename | cut -d' ' -f2,4- | sed -n -e 's/Ignored.*//p' | awk -v ip="$ip" -v project="$project" '{$1=""; for(i=2; i<=NF; i++) { a=a" "$i; }; split(a,s,","); for(e in s) { split(s[e],v,"/"); if (v[2] == "closed") { printf project "," ip ",%s,%s\n" , v[1], v[5]}}; a="" }';
done;
done
mkdir logs
cat gcp-project-ips.csv | cut -f1 -d, | sort -u | while read project; do mkdir logs/${project}; done
cat gcp-project-ips.csv | while IFS="," read -r project ip; do echo nmap -sT -T5 -Pn -p- -oG logs/${project}/${ip}.gnmap $ip; done > scan-all-ips.out
parallel --jobs 32 < scan-all-ips.out