Skip to content

Instantly share code, notes, and snippets.

@guim1111
guim1111 / chekcUpIps.sh
Last active December 10, 2019 13:24
Extract up hosts in /24 networks to csv for OpenVas using nmap -sp (so nmap needed)
#!/bin/bash
#script extract the IPs of a network that answer to a ping request
#create a csv for others automated vuln scanners
#use fo this: ./checkUpIps.sh 192.168.1.0 (only networks /24 ended with 0 without writing /24)
ip=$1
ipname=$(echo $1 | tr . -)
nameResult='ips'$ipname'.txt'
namecsv='onlyIps'$ipname'.csv'
@guim1111
guim1111 / registerIp.py
Last active December 18, 2019 10:29
For home, it can be usefull to get your external ip to get your services from internet to your home network, evrey time ip change, will send a email to previous configuration
#Auth
#python3.4 or newer
#use "screen python3 registerIp.py" for better experience then ctrl+a+d and 'screen -r' (see more screen linux command on google)
#to stop ctrl + c
#interesting url to develope this
#help from https://medium.com/greedygame-engineering/an-elegant-way-to-run-periodic-tasks-in-python-61b7c477b679 (but in python 2)
#if you want to mount your own server https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-16-04
#https://www.freecodecamp.org/news/send-emails-using-code-4fcea9df63f/
#
#This script is designed for who wants the external ip and send it with email. For who want to have services at home
@guim1111
guim1111 / nmapAutomated.sh
Created December 18, 2019 11:11
Combined with my "checkUpIps.sh", not fully finished but work well (not performed "resume" function to restart nmap interrupted)
#!/bin/bash
#arguments are <ip range to set name to a folder> <csv (',' separator) with all ip you want>
#you can use this script with a csv generated by checkUpIps.sh
#organize nmap outputs inside a folder, show output console to know for what ip is going inside the csv
#./nmapAutomated.sh 192.158.2.0 example.csv
namefolder='nmap'$(echo $1 | tr . -)
mkdir -p $namefolder
while IFS="," read col1
do
@guim1111
guim1111 / tmp.txt
Created December 18, 2019 17:01
my tmp code to work after
import sys, subprocess
print(sys.argv[1])
proc = subprocess.Popen([sys.argv[1]], stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
print(out.decode("utf-8"))
@guim1111
guim1111 / getVulnConcurrence.py
Last active March 9, 2020 10:54
This script is for OpenVas to have ips affectef for each vuln, usefull if you need to write a report of large scans and need all ips and ports that have each vuln
#pip3 install pandas
#tested on ubuntu 18.04 python 3.7
#help from: https://beenje.github.io/blog/posts/parsing-html-tables-in-python-with-pandas/
#DESCRIPTION: with a file.html extracted from openvas with results, it show each vuln with assets that have,
#usefull for massive scans and need to write a report
#tip: use filter "rows=" at "Scans>Results" menu with a big number to be faster
#url example: https://<IP_OPENVAS>:9392/omp?cmd=get_results&filter=first=301 rows=200 severity>6.9 rows=200 first=101 sort=vulnerability min_qod=70 apply_overrides=1 autofp=0&token=XXXXXXXXXXXXXXXXXXXXXXX
#download (or copy) all content of page (like previous url) and put in a file that pass as argument
#python3 getVulnCoincidence.py ./file.html