Skip to content

Instantly share code, notes, and snippets.

View VGostyuzhov's full-sized avatar

Valentin Gostyuzhov VGostyuzhov

View GitHub Profile
@VGostyuzhov
VGostyuzhov / gen_ip_list.py
Last active February 12, 2017 20:55
Reads file with networks(CIDR or range format) and generates list of IP addresses, contained in this networks.
import ipaddress
import re
firstIP_pattern = re.compile('^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)')
lastIP_pattern = re.compile('(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$')
CIDR_pattern = re.compile('^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$')
@VGostyuzhov
VGostyuzhov / parse_hostnames.py
Created February 13, 2017 11:27
Parse hostnames from URLs
#!/usr/bin/python
from urlparse import urlparse
from argparse import ArgumentParser
import sys
def main():
parser = ArgumentParser(description='Provide file with URLs and file to save extracted hostnames')
parser.add_argument('-i', dest='input_filename', help='Enter name of input file, containing URLs', metavar='FILE')
parser.add_argument('-o', dest='output_filename', help='Enter name of output file to save extracted hostnames', metavar='FILE')
if len(sys.argv) == 1:
@VGostyuzhov
VGostyuzhov / ip_whois.py
Last active April 26, 2017 12:41
Query Whois for each IP from file, get info about Netwrok for that IP and saves it into CSV file. Requirements: pip install ipwhois, argparse
#!/usr/bin/python
from ipwhois import IPWhois
import sys
import csv
from argparse import ArgumentParser
def whois_query_ip(ip):
whois_nets = []
try:
query = IPWhois(ip)
@VGostyuzhov
VGostyuzhov / resolver.py
Last active April 7, 2017 11:38
Resolve IP address for each hostname from file and save it to the new file.
import dns.resolver
with open('hostnames.txt', 'r') as file, open('result_resovle.csv', 'wb') as outfile:
for line in file:
try:
answers = dns.resolver.query(line.strip(), 'A')
for rdata in answers:
outfile.write(line.strip() + ':' + rdata.to_text() + '\n')
except:
outfile.write(line.strip() + '\n')
@VGostyuzhov
VGostyuzhov / scan-axfr.py
Last active November 5, 2021 09:34
This script checks bunch of domains for DNS Zone Transfer vulnerability. Usage: python dns_axfr.py domains.txt where 'domains.txt' file with list of domains to scan. Requirements: pip install dnspython,termcolor
import sys
import dns.resolver
import dns.query
import dns.zone
import csv
from termcolor import colored
from pprint import pprint
resolver = dns.resolver.Resolver()
version: '2'
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.5.2
container_name: elasticsearch1
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
#!/usr/bin/python
from openpyxl import Workbook, load_workbook
from pprint import pprint
import csv
wb = load_workbook('file.xlsx')
ws = wb.get_sheet_by_name('sheet')
hosts = {}
#!/usr/bin/python
import sys
import dns.resolver
resolver = dns.resolver.Resolver()
resolver.timeout = 5
resolver.lifetime = 5
if __name__ == '__main__':
source_file = sys.argv[1]
@VGostyuzhov
VGostyuzhov / opencv_webcam.py
Created March 21, 2018 06:45
Capture webcam stream using opencv2 library.
import cv2
cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output.avi', fourcc, 20.0, (1024,768))
while(True):
ret, frame = cap.read()
@VGostyuzhov
VGostyuzhov / patator_CSRF
Created March 30, 2018 14:28
Patator brute for CSRF protected login form in pentestit.lab10
patator http_fuzz \
url="http://192.168.101.10:88/index.php?module=Users&action=Login" \
body='__vtrftk=_CSRF_&username=admin&password=FILE0' \
0="~/SecLists/Passwords/10_million_password_list_top_100000.txt"
method=POST \
accept_cookie=1 \
follow=1 \
--threads 1 \
timeout=60 \
timeout_tcp=60 \