Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
firewall-1 authored Jan 6, 2023
1 parent 78f8f85 commit cef0716
Show file tree
Hide file tree
Showing 31 changed files with 217 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# ufw-php-gui
UFW (Universal Firewall) PHP GUI
# ufw-php-gui
UFW (Universal Firewall) PHP GUI
15 changes: 15 additions & 0 deletions php_ufw_insert_rule_for_specific_ip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#/bin/bash
src_ip=$1

echo "You are inserting SOURCE IP: $src_ip" > /var/log/php_ufw_insert_specific_ip.txt
ufw insert 1 deny from $src_ip to any >> /var/log/php_ufw_insert_specific_ip.txt
if [ $? -eq 0 ]
then
echo "UFW rule inserted succesfully" >> /var/log/php_ufw_insert_specific_ip.txt
cat /var/log/php_ufw_insert_specific_ip.txt
exit 0
else
echo "UFW rule insertion aborted" >&2 >> /var/log/php_ufw_insert_specific_ip.txt
cat /var/log/php_ufw_insert_specific_ip.txt
exit 1
fi
15 changes: 15 additions & 0 deletions php_ufw_insert_rule_for_specific_ip.sh.ORIG
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#/bin/bash
src_ip=$1

echo "You are inserting SOURCE IP: $src_ip" > /var/log/php_ufw_insert_specific_ip.txt
ufw insert 1 deny from $src_ip to any >> /var/log/php_ufw_insert_specific_ip.txt
if [ $? -eq 0 ]
then
echo "UFW rule inserted succesfully" >> /var/log/php_ufw_insert_specific_ip.txt
cat /var/log/php_ufw_insert_specific_ip.txt
exit 0
else
echo "UFW rule insertion aborted" >&2 >> /var/log/php_ufw_insert_specific_ip.txt
cat /var/log/php_ufw_insert_specific_ip.txt
exit 1
fi
15 changes: 15 additions & 0 deletions php_ufw_insert_rule_for_specific_ip.sh_V1.0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#/bin/bash
src_ip=$1

echo "You are inserting SOURCE IP: $src_ip" > /var/log/php_ufw_insert_specific_ip.txt
ufw insert 1 deny from $src_ip to any >> /var/log/php_ufw_insert_specific_ip.txt
if [ $? -eq 0 ]
then
echo "UFW rule inserted succesfully" >> /var/log/php_ufw_insert_specific_ip.txt
cat /var/log/php_ufw_insert_specific_ip.txt
exit 0
else
echo "UFW rule insertion aborted" >&2 >> /var/log/php_ufw_insert_specific_ip.txt
cat /var/log/php_ufw_insert_specific_ip.txt
exit 1
fi
9 changes: 9 additions & 0 deletions php_ufw_list_blocked_ports_for_specific_ip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#/bin/bash
src_ip=$1
total_ports=`zgrep -i $src_ip /var/log/syslog* | cut -d " " -f21 | cut -d "=" -f2 | egrep -v "(^\s*$|^#)" | sort -nr | uniq -c | sort -nk2 | wc -l`

echo "You are looking for SOURCE IP: $src_ip" > /var/log/php_ufw_list_blocked_ports_for_specific_ip.txt
echo "Total ports scanned: $total_ports" >> /var/log/php_ufw_list_blocked_ports_for_specific_ip.txt
echo `zgrep -i $src_ip /var/log/syslog* | cut -d " " -f21 | cut -d "=" -f2 | egrep -v "(^\s*$|^#)" | sort -nr | uniq -c | sort -nk2 >> /var/log/php_ufw_list_blocked_ports_for_specific_ip.txt`

cat /var/log/php_ufw_list_blocked_ports_for_specific_ip.txt
9 changes: 9 additions & 0 deletions php_ufw_list_blocked_ports_for_specific_ip_v1.0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#/bin/bash
src_ip=$1
total_ports=`zgrep -i $src_ip /var/log/syslog* | cut -d " " -f21 | cut -d "=" -f2 | egrep -v "(^\s*$|^#)" | sort -nr | uniq -c | sort -nk2 | wc -l`

echo "You are looking for SOURCE IP: $src_ip" > /var/log/php_ufw_list_blocked_ports_for_specific_ip.txt
echo "Total ports scanned: $total_ports" >> /var/log/php_ufw_list_blocked_ports_for_specific_ip.txt
echo `zgrep -i $src_ip /var/log/syslog* | cut -d " " -f21 | cut -d "=" -f2 | egrep -v "(^\s*$|^#)" | sort -nr | uniq -c | sort -nk2 >> /var/log/php_ufw_list_blocked_ports_for_specific_ip.txt`

cat /var/log/php_ufw_list_blocked_ports_for_specific_ip.txt
9 changes: 9 additions & 0 deletions php_ufw_list_blocked_ports_for_specific_ip_v1.0.sh.ORIG
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#/bin/bash
src_ip=$1
total_ports=`zgrep -i $src_ip /var/log/syslog* | cut -d " " -f21 | cut -d "=" -f2 | egrep -v "(^\s*$|^#)" | sort -nr | uniq -c | sort -nk2 | wc -l`

echo "You are looking for SOURCE IP: $src_ip" > /var/log/php_ufw_list_blocked_ports_for_specific_ip.txt
echo "Total ports scanned: $total_ports" >> /var/log/php_ufw_list_blocked_ports_for_specific_ip.txt
echo `zgrep -i $src_ip /var/log/syslog* | cut -d " " -f21 | cut -d "=" -f2 | egrep -v "(^\s*$|^#)" | sort -nr | uniq -c | sort -nk2 >> /var/log/php_ufw_list_blocked_ports_for_specific_ip.txt`

cat /var/log/php_ufw_list_blocked_ports_for_specific_ip.txt
5 changes: 5 additions & 0 deletions php_ufw_list_deny_rules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#/bin/bash
#echo "You are looking for SOURCE IP: $src_ip" > /var/log/php_ufw_list_deny_rules.txt
echo `ufw status numbered | egrep "DENY IN" -B4 > /var/log/php_ufw_list_deny_rules.txt`

cat /var/log/php_ufw_list_deny_rules.txt
4 changes: 4 additions & 0 deletions php_ufw_list_overall_top_10_blocked_sources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#/bin/bash
# This Script lists the UFW TOP 10 SOURCE IPs
echo `zcat -f /var/log/syslog* | awk ' /'SRC='/ {print $12} ' | cut -d "=" -f2 | egrep -v "(^\s*$|^#)" | sort -nr | uniq -c | sort -nr | head -10 > /var/log/php_ufw_overall_top10_blocked_src_ip_output.txt`
cat /var/log/php_ufw_overall_top10_blocked_src_ip_output.txt
4 changes: 4 additions & 0 deletions php_ufw_list_overall_top_10_blocked_sources_per_day.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#/bin/bash
# This Script lists the UFW TOP 10 SOURCE IPs per day
echo `zcat -f /var/log/syslog | awk ' /'SRC='/ {print $12} ' | cut -d "=" -f2 | egrep -v "(^\s*$|^#)" | sort -nr | uniq -c | sort -nr | head -10 > /var/log/php_ufw_overall_top10_blocked_src_ip_per_day_output.txt`
cat /var/log/php_ufw_overall_top10_blocked_src_ip_per_day_output.txt
4 changes: 4 additions & 0 deletions php_ufw_list_overall_top_10_blocked_sources_per_day_v1.0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#/bin/bash
# This Script lists the UFW TOP 10 SOURCE IPs per day
echo `zcat -f /var/log/syslog | awk ' /'SRC='/ {print $12} ' | cut -d "=" -f2 | egrep -v "(^\s*$|^#)" | sort -nr | uniq -c | sort -nr | head -10 > /var/log/php_ufw_overall_top10_blocked_src_ip_per_day_output.txt`
cat /var/log/php_ufw_overall_top10_blocked_src_ip_per_day_output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#/bin/bash
# This Script lists the UFW TOP 10 SOURCE IPs per day
echo `zcat -f /var/log/syslog | awk ' /'SRC='/ {print $12} ' | cut -d "=" -f2 | egrep -v "(^\s*$|^#)" | sort -nr | uniq -c | sort -nr | head -10 > /var/log/php_ufw_overall_top10_blocked_src_ip_per_day_output.txt`
cat /var/log/php_ufw_overall_top10_blocked_src_ip_per_day_output.txt
4 changes: 4 additions & 0 deletions php_ufw_list_overall_top_10_blocked_sources_v1.0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#/bin/bash
# This Script lists the UFW TOP 10 SOURCE IPs
echo `zcat -f /var/log/syslog* | awk ' /'SRC='/ {print $12} ' | cut -d "=" -f2 | egrep -v "(^\s*$|^#)" | sort -nr | uniq -c | sort -nr | head -10 > /var/log/php_ufw_overall_top10_blocked_src_ip_output.txt`
cat /var/log/php_ufw_overall_top10_blocked_src_ip_output.txt
4 changes: 4 additions & 0 deletions php_ufw_list_overall_top_10_blocked_sources_v1.0.sh.ORIG
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#/bin/bash
# This Script lists the UFW TOP 10 SOURCE IPs
echo `zcat -f /var/log/syslog* | awk ' /'SRC='/ {print $12} ' | cut -d "=" -f2 | egrep -v "(^\s*$|^#)" | sort -nr | uniq -c | sort -nr | head -10 > /var/log/php_ufw_overall_top10_blocked_src_ip_output.txt`
cat /var/log/php_ufw_overall_top10_blocked_src_ip_output.txt
5 changes: 5 additions & 0 deletions seite1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<form action="seite2.php" method="post">
Vorname: <input type="text" name="vorname" /><br />
Namename: <input type="text" name="nachname" /><br />
<input type="Submit" value="Absenden" />
</form
4 changes: 4 additions & 0 deletions seite1_ufw.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<form action="seite2_ufw.php" method="post">
Please enter your source IP: <input type="text" name="src_ip" /><br />
<input type="Submit" value="Submit" />
</form
4 changes: 4 additions & 0 deletions seite1_ufw.php.ORIG
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<form action="seite2_ufw.php" method="post">
Source IP: <input type="text" name="src_ip" /><br />
<input type="Submit" value="Absenden" />
</form
5 changes: 5 additions & 0 deletions seite2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
$vorname = $_POST["vorname"];
$nachname = $_POST["nachname"];
echo "Hallo $vorname $nachname";
?>
14 changes: 14 additions & 0 deletions seite2_ufw.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
$src_ip = $_POST["src_ip"];
if(!filter_var($src_ip, FILTER_VALIDATE_IP)) {
echo "Not a valid IP address!";
exit();
}
$src_ip = $_POST["src_ip"];
echo "You are searching for blocked ports from source IP: $src_ip";

echo "Lists the blocked ports by UFW from source IP address $src_ip";
$result1 = shell_exec("sudo /var/www/scripts/php_ufw_list_blocked_ports_for_specific_ip.sh {$_POST["src_ip"]}");

echo "<pre>$result1</pre>";
?>
9 changes: 9 additions & 0 deletions seite2_ufw.php.ORIG
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
$src_ip = $_POST["src_ip"];
echo "You are searching for blocked ports from source IP: $src_ip";

echo "Lists the blocked ports from source IP addresses from UFW";
$result1 = shell_exec('sudo /var/www/scripts/php_ufw_list_blocked_ports_for_specific_ip.sh "$src_ip"');

echo "<pre>$result1</pre>";
?>
4 changes: 4 additions & 0 deletions test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
$script = "sudo /var/www/scripts/php_ufw_list_overall_top_10_sources.sh";
$run=`$script`;
?>
5 changes: 5 additions & 0 deletions test_form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<form action="form2.php" method="post">
<input type="text" size="17" name="Inhalt">
<input type="submit" value="OK">
echo $_POST["Inhalt"];
</form>
5 changes: 5 additions & 0 deletions test_input.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
$vorname = $_GET['vorname'];
$nachname = $_GET['nachname'];
echo "Hallo $vorname $nachname";
?>
5 changes: 5 additions & 0 deletions test_input_v1.0.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
$vorname = $_GET['vorname'];
$nachname = $_GET['nachname'];
echo "Hallo $vorname $nachname";
?>
5 changes: 5 additions & 0 deletions test_input_v1.0.php.ORIG
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
$vorname = $_GET['vorname'];
$nachname = $_GET['nachname'];
echo "Hallo $vorname $nachname";
?>
4 changes: 4 additions & 0 deletions test_v3.0.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
$result = shell_exec('sudo /var/www/scripts/php_ufw_list_overall_top_10_sources.sh');
echo "<pre>$result</pre>";
?>
9 changes: 9 additions & 0 deletions test_v4.0.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
echo "Lists the TOP 10 blocked source IP addresses including the overall hitcount from UFW";
$result1 = shell_exec('sudo /var/www/scripts/php_ufw_list_overall_top_10_blocked_sources.sh');
echo "<pre>$result1</pre>";

echo "Lists the TOP 10 blocked source IP addresses per day including the overall hitcount from UFW";
$result1 = shell_exec('sudo /var/www/scripts/php_ufw_list_overall_top_10_blocked_sources_per_day.sh');
echo "<pre>$result1</pre>";
?>
13 changes: 13 additions & 0 deletions ufw.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
echo "Lists the TOP 10 UFW blocked source IP addresses including the overall hitcount from ONE WEEK";
$result1 = shell_exec('sudo /var/www/scripts/php_ufw_list_overall_top_10_blocked_sources.sh');
echo "<pre>$result1</pre>";

echo "Lists the TOP 10 UFW blocked source IP addresses including the overall hitcount from TODAY";
$result1 = shell_exec('sudo /var/www/scripts/php_ufw_list_overall_top_10_blocked_sources_per_day.sh');
echo "<pre>$result1</pre>";
?>
<form action="seite2_ufw.php" method="post">
Please enter your source IP: <input type="text" name="src_ip" /><br />
<input type="Submit" value="Submit" />
</form
4 changes: 4 additions & 0 deletions ufw_ask_rules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<form action="ufw_deny_rules.php" method="post">
Do you want to see your UFW deny rules?: <input type="button" name="YES" value="YES" /><br />
<input type="Submit" value="Submit" />
</form
5 changes: 5 additions & 0 deletions ufw_deny_rules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
$YES = $_POST["YES"];
$result1 = shell_exec("sudo /var/www/scripts/php_ufw_list_deny_rules.sh");
echo "<pre>$result1</pre>"
?>
14 changes: 14 additions & 0 deletions ufw_v1.0.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
echo "Lists the TOP 10 UFW blocked source IP addresses including the overall hitcount from ONE WEEK";
$result1 = shell_exec('sudo /var/www/scripts/php_ufw_list_overall_top_10_blocked_sources.sh');
echo "<pre>$result1</pre>";

echo "Lists the TOP 10 UFW blocked source IP addresses including the overall hitcount from TODAY";
$result1 = shell_exec('sudo /var/www/scripts/php_ufw_list_overall_top_10_blocked_sources_per_day.sh');
echo "<pre>$result1</pre>";
?>
<form action="seite2_ufw.php" method="post">
You want to lookup for scanned ports?
Please enter your source IP: <input type="text" name="src_ip" /><br />
<input type="Submit" value="Submit" />
</form

0 comments on commit cef0716

Please sign in to comment.