void

- enter the void 🪐
git clone git://git.acid.vegas/archlinux.git
Log | Files | Refs | Archive

.bash_recon (1856B)

      1 #!/bin/sh
      2 # .bash_recon - developed by acidvegas (https://git.acid.vegas/void)
      3 
      4 asn2ranges() {
      5 	local cache_file="/tmp/.bgp_tools_table_cache"
      6 	local current_time=$(date +%s)
      7 	local update_interval=$((2 * 60 * 60)) # 2 hours in seconds
      8 	if [ -f "$cache_file" ]; then
      9 		local last_update=$(date -r "$cache_file" +%s)
     10 		local time_diff=$(($current_time - $last_update))
     11 		if [ $time_diff -gt $update_interval ]; then
     12 			curl -A 'acmeco bgp.tools - acid.vegas@acid.vegas' -s https://bgp.tools/table.txt -o "$cache_file"
     13 		fi
     14 	else
     15 		curl -A 'acmeco bgp.tools - acid.vegas@acid.vegas' -s https://bgp.tools/table.txt -o "$cache_file"
     16 	fi
     17 	awk -v asn="$1" '$NF == asn {print $1}' "$cache_file"
     18 }
     19 
     20 asn2search() {
     21 	local search_string="$1"
     22 	local cache_file="/tmp/.bgp_tools_asn_cache"
     23 	local current_time=$(date +%s)
     24 	local update_interval=$((24 * 60 * 60)) # 24 hours in seconds
     25 	if [ -f "$cache_file" ]; then
     26 		local last_update=$(date -r "$cache_file" +%s)
     27 		local time_diff=$(($current_time - $last_update))
     28 		if [ $time_diff -gt $update_interval ]; then
     29 			curl -A 'acmeco bgp.tools - acid.vegas@acid.vegas' -s https://bgp.tools/asns.csv -o "$cache_file"
     30 		fi
     31 	else
     32 		curl -A 'acmeco bgp.tools - acid.vegas@acid.vegas' -s https://bgp.tools/asns.csv -o "$cache_file"
     33 	fi
     34 	grep -i "$search_string" "$cache_file"
     35 }
     36 
     37 atlastream() {
     38 	curl -s "https://atlas-stream.ripe.net/stream/?streamType=result&msm=1001" # FOR COWBOYS ONLY
     39 }
     40 
     41 bgplookup() {
     42 	if [ -f "$1" ]; then
     43 		{ echo "begin"; echo "verbose"; echo "count"; cat "$1"; echo "end"; } | nc bgp.tools 43
     44 	else
     45 		whois -h bgp.tools " -v $1"
     46 	fi
     47 }
     48 
     49 bgpstream() {
     50 	curl -s "https://ris-live.ripe.net/v1/stream/?format=json&client=hacktheplnet" # FOR COWBOYS ONLY
     51 }
     52 
     53 crtsh() {
     54 	curl -s "https://crt.sh/?q=$1&output=json" | jq -r '.[].name_value' | sort | uniq
     55 }
     56 
     57 shodan() {
     58 	curl https://internetdb.shodan.io/$1
     59 }