Changes

Jump to navigation Jump to search
Line 69: Line 69:  
== counter_attack.sh ==
 
== counter_attack.sh ==
 
<source lang=bash>#!/bin/bash
 
<source lang=bash>#!/bin/bash
 +
WD=/opt/counter_attack_ssh
 +
newest_log=${WD}/newest_log.txt
 +
old_log=${WD}/old_log.txt
 +
portscan_script=${WD}/portscan.py
   −
brute > newest_log.txt
+
function save_old_log{
input="newest_log.txt"
+
    cat ${newest_log} >> ${old_log}
 +
}
 +
 
 +
save_old_log
 +
/usr/bin/brute > ${newest_log}
 +
input="${newest_log}"
      Line 78: Line 87:  
   ipaddress=$( echo "$var" | awk -F " -->" '{print $2}' )
 
   ipaddress=$( echo "$var" | awk -F " -->" '{print $2}' )
 
   #echo "$ipaddress"
 
   #echo "$ipaddress"
   python portscan.py -H "$ipaddress"  
+
   python ${portscan_script} -H "$ipaddress"
 
done < "$input"</source>
 
done < "$input"</source>

Navigation menu