Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Countering SSH bruteforce attacks
(edit)
Revision as of 15:51, 13 November 2018
207 bytes added
,
15:51, 13 November 2018
→counter_attack.sh
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>
Rafahsolis
Bureaucrats
,
Administrators
2,306
edits
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
Variants
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version