Dynamic Black/Whitelists in your script.

This section contains scripts that hMailServer has contributed with. hMailServer 5 is needed to use these.
palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-04-29 00:48

Now with pagination. Change $no_of_records_per_page to whatever you want.

Code: Select all

<?php
$connect = mysqli_connect("localhost", "hmailserver", "supersecretpassword", "hmailserver");

if (isset($_GET['page'])) {
	$page = $_GET['page'];
	$display_pagination = 1;
} else {
	$page = 1;
	$total_pages = 1;
	$display_pagination = 0;
}

$no_of_records_per_page = 10;
$offset = ($page-1) * $no_of_records_per_page;
$total_pages_sql = "SELECT Count( * ) AS count FROM hm_mylists";
$result_rows = mysqli_query($connect,$total_pages_sql);
$total_rows = mysqli_fetch_array($result_rows)[0];
$total_pages = ceil($total_rows / $no_of_records_per_page);

$query = "SELECT * FROM hm_mylists ORDER BY id DESC LIMIT ".$offset.", ".$no_of_records_per_page;
$result = mysqli_query($connect,$query);

?>
<html>
 <head>
    <title>Live Table Data Edit Delete using Tabledit Plugin in PHP</title>
    <link rel="stylesheet" type="text/css" href="bootstrap.min.css" />
    <script src="jquery.min.js"></script>
    <script src="bootstrap.min.js"></script>
    <script src="jquery.tabledit.min.js"></script>
    </head>
    <body>
  <div class="container">
   <br />

<?php

if (isset($_GET['insert_function'])) {$insert_function = mysqli_real_escape_string($connect, $_GET['insert_function']);} else {$insert_function="";}
if (isset($_GET['insert_field'])) {$insert_field = mysqli_real_escape_string($connect, $_GET["insert_field"]);} else {$insert_field="";}
if (isset($_GET['insert_data'])) {$insert_data = mysqli_real_escape_string($connect, $_GET["insert_data"]);} else {$insert_data="";}
if (isset($_GET['insert_active'])) {$insert_active = mysqli_real_escape_string($connect, $_GET["insert_active"]);} else {$insert_active="";}

if ((!empty($insert_function)) && (!empty($insert_field)) && (!empty($insert_data))){
	$insert_query = "INSERT INTO hm_mylists (function,field,data,hits,lastused,active) VALUES ('".$insert_function."','".$insert_field."','".$insert_data."',0,NOW(),'".$insert_active."');";
	mysqli_query($connect, $insert_query);
	header("Location: ./index.php");
}

?>

    <table class="table">
     <thead>
      <tr>
       <th>Function</th>
       <th>Field</th>
       <th>Data</th>
       <th>Active</th>
       <th>Submit</th>
      </tr>
     </thead>
	 
	 
     <tbody>
		<tr>
			<form action='index.php' method='GET' onsubmit='return confirm(\"Are you sure you want to add this entry?\");'>
			<td>
				<input type='text' size='20' name='insert_function'>
			</td>
			<td>
				<input type='text' size='20' name='insert_field'>
			</td>
			<td>
				<input type='text' size='40' name='insert_data'>
			</td>
			<td>
				<select name='insert_active'>
					<option value=1>Yes</option>
					<option value=0>No</option>
				</select>
			</td>
			<td>
				<input type='submit' name='submit' value='Submit' >
			</td>
			</form>
		</tr>
     </tbody>
    </table>





   <br />
   <br />
            <div class="table-responsive">
    <h3 align="center">Live Table Data Edit Delete using Tabledit Plugin in PHP</h3><br />
    <table id="editable_table" class="table table-bordered table-striped">
     <thead>
      <tr>
       <th>ID</th>
       <th>Function</th>
       <th>Field</th>
       <th>Data</th>
       <th>Hits</th>
       <th>Last Used</th>
       <th>Active</th>
      </tr>
     </thead>
     <tbody>
     <?php
     while($row = mysqli_fetch_array($result))
     {
      echo '
      <tr>
       <td>'.$row["id"].'</td>
       <td>'.$row["function"].'</td>
       <td>'.$row["field"].'</td>
       <td>'.$row["data"].'</td>
       <td>'.$row["hits"].'</td>
       <td>'.$row["lastused"].'</td>
       <td>'.$row["active"].'</td>
      </tr>
      ';
     }
     ?>
     </tbody>
    </table>
<?php
if ($total_pages < 2){echo "";}
else {
	echo "<ul class='pagination'>";
	if($page <= 1){echo "<li class='page-item'><a class='page-link' href='#'>First </a></li>";} else {echo "<li class='page-item'><a class='page-link' href=\"index.php?page=1\">First </a><li>";}
	if($page <= 1){echo "<li><a class='page-link' href='#'>Prev </a></li class='page-item'>";} else {echo "<li class='page-item'><a class='page-link' href=\"index.php?page=".($page - 1)."\">Prev </a></li>";}
	if($page >= $total_pages){echo "<li class='page-item'><a class='page-link' href='#'>Next </a></li>";} else {echo "<li class='page-item'><a class='page-link' href=\"index.php?page=".($page + 1)."\">Next </a></li>";}
	if($page >= $total_pages){echo "<li class='page-item'><a class='page-link' href='#'>Last</a></li>";} else {echo "<li class='page-item'><a class='page-link' href=\"index.php?page=".$total_pages."\">Last</a></li>";}
	echo "</ul>";
}
if ($total_pages > 0){
	echo "<br />";
}
?>
   </div>
  </div>
 </body>
</html>
<script>
$(document).ready(function(){
     $('#editable_table').Tabledit({
      url:'action.php',
      columns:{
       identifier:[0, "id"],
       editable:[[1, 'function'], [2, 'field'], [3, 'data'], [6, 'active']]
      },
      restoreButton:false,
      onSuccess:function(data, textStatus, jqXHR)
      {
       if(data.action == 'delete')
       {
        $('#'+data.id).remove();
       }
      }
     });

});
 </script>

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-04-29 11:18

Did you check the last one i posted (framework.rar) ?

Direct edit in table, sorting, pagination and search... Checks all the boxes.
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-04-29 13:17

SorenR wrote:
2020-04-29 11:18
Did you check the last one i posted (framework.rar) ?

Direct edit in table, sorting, pagination and search... Checks all the boxes.
I got js errors right off the bat so I didn't try to figure out what was going on. I'll give it another try and see if I can get it working.

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-04-29 13:30

Oh yeah, now that I'm looking at it again I remember the other reason: it needs a complete rewrite. :lol:

I'll see what I can do. Need some time. Today/tomorrow work is pretty busy. Also, remember, there's a gaping hole in my head for js, but looks like there's enough example there to figure it out. I just have to keep a reference copy unaltered. :mrgreen:

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-04-29 14:36

palinka wrote:
2020-04-29 13:30
Oh yeah, now that I'm looking at it again I remember the other reason: it needs a complete rewrite. :lol:

I'll see what I can do. Need some time. Today/tomorrow work is pretty busy. Also, remember, there's a gaping hole in my head for js, but looks like there's enough example there to figure it out. I just have to keep a reference copy unaltered. :mrgreen:
For reference ...
https://www.webslesson.info/2017/07/liv ... -ajax.html

I grabbed a copy of the js and css just to have them locally, they are also in the rar file :mrgreen:
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-04-29 18:02

Having trouble with this error. Not sure how to troubleshoot it. It was there before I touched it and still there.
Screenshot_20200429-120029_Brave.jpg

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-04-29 19:54

palinka wrote:
2020-04-29 18:02
Having trouble with this error. Not sure how to troubleshoot it. It was there before I touched it and still there.

Screenshot_20200429-120029_Brave.jpg
You have PM..
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-04-29 19:57

SorenR wrote:
2020-04-29 19:54
palinka wrote:
2020-04-29 18:02
Having trouble with this error. Not sure how to troubleshoot it. It was there before I touched it and still there.

Screenshot_20200429-120029_Brave.jpg
You have PM..
Got it. You didn't get any js errors? What about before you entered mysql credentials? Did you open the page before changing the credentials?

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-04-29 20:02

Was just playing with your demo. Yeah, it looks great. Very cool. I'll play with this thing tonight.

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-04-29 20:06

palinka wrote:
2020-04-29 19:57
SorenR wrote:
2020-04-29 19:54
palinka wrote:
2020-04-29 18:02
Having trouble with this error. Not sure how to troubleshoot it. It was there before I touched it and still there.

Screenshot_20200429-120029_Brave.jpg
You have PM..
Got it. You didn't get any js errors? What about before you entered mysql credentials? Did you open the page before changing the credentials?
I first unpacked it on server and accessed it from browser (no database) and it came up no errors but blank cells...
The one you see I simply copied the directory from IIS on Windows 2003 Server R2 to Apache on my Synology NAS (Linux). Database remains on Windows 8)
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-04-29 20:11

SorenR wrote:
2020-04-29 20:06
palinka wrote:
2020-04-29 19:57
SorenR wrote:
2020-04-29 19:54


You have PM..
Got it. You didn't get any js errors? What about before you entered mysql credentials? Did you open the page before changing the credentials?
I first unpacked it on server and accessed it from browser (no database) and it came up no errors but blank cells...
The one you see I simply copied the directory from IIS on Windows 2003 Server R2 to Apache on my Synology NAS (Linux). Database remains on Windows 8)
That's weird. I got the same error on Brave mobile, Brave PC and MS Edge. I guess I'll just delete it and start over. I must have done something to break it at the very beginning.

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-04-29 20:21

palinka wrote:
2020-04-29 20:11
SorenR wrote:
2020-04-29 20:06
palinka wrote:
2020-04-29 19:57


Got it. You didn't get any js errors? What about before you entered mysql credentials? Did you open the page before changing the credentials?
I first unpacked it on server and accessed it from browser (no database) and it came up no errors but blank cells...
The one you see I simply copied the directory from IIS on Windows 2003 Server R2 to Apache on my Synology NAS (Linux). Database remains on Windows 8)
That's weird. I got the same error on Brave mobile, Brave PC and MS Edge. I guess I'll just delete it and start over. I must have done something to break it at the very beginning.
All browsers except IE8 work flawlesly. Even my old Huawei P8 phone... On IE8 the page looks off but is useable.
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-04-29 23:09

Turned out to be a MySQL connection/credential (syntax) issue after all. Error gone now and the test data displays properly.

The rest should go easier. :roll:

Flukin' js... It was hiding the php errors.

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-04-30 14:59

Something is going on that I cannot figure out. I hit a roadblock. More like the bridge over river kwai...

Download the attached. I keep getting the same json error. If you point your browser to fetch.php, it seems to render the json correctly. I "prettified" it for viewing. You can change that back in fetch.php by changing

echo json_encode($output, JSON_PRETTY_PRINT);

back to

echo json_encode($output);

Either way I get the same result. This has something to do with the js and I'm out of my league here. However, all the php parts work. Insert works. I assume update and delete work as well, but I can't test them because I can't get the data to display.

Another thing is, I had to change the MySQL column names because they conflict with js reserved words "function" and "data". So I changed the columns to xfunction, xfield and xdata. Keep that in mind when you test yours.

I've been over the js, but its not my thing and I'm just stumped.
Attachments
mylists.zip
(156.93 KiB) Downloaded 32 times

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-01 18:38

Working final version in case anyone wants.
Attachments
yourlists.zip
(159.95 KiB) Downloaded 32 times

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-05-01 19:18

palinka wrote:
2020-05-01 18:38
Working final version in case anyone wants.
Not working on my Linux/Apache since you converted to PDO :roll: Will spend some time later to investigate.

Anyways I just read that in Portland you can order a "Boober"... The norm is having "Uber" deliver food but Lucky Devil Lounge in Portland now have strippers deliver your food, optionally you can collect yourself as they also have a drive-thru strip tent for when you are waiting for your food.

"Food to GoGo"... And the best thing :!:

It started as a joke on Twitter :mrgreen:

The world is full of endless oportunities 8)
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-01 19:21

:mrgreen: :mrgreen: :mrgreen:

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-01 19:28

SorenR wrote:
2020-05-01 19:18
Not working on my Linux/Apache since you converted to PDO :roll: Will spend some time later to investigate.
Simple things: typo, spelling mistakes? Did you choose the correct "driver" in the config?

Php.ini:

extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
extension=php_pdo_oci.dll
extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll

Pick your poison. :wink:

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-05-01 20:03

phpinfo() says...
Attachments
pdo.png
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-01 20:48

Try enabling extension=php_pdo_odbc.dll and using that.

Edit. Just thinking. Do you have SSL required on your mysql? There are no security settings in the connection strings.

Edit 2: security settings are database specific in mysql (I think) and you're using the hmailserver database, so it should be the default settings that hmailserver uses when you first install it.

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-01 21:28

OK, I looked at your event handlers from the previous page (the first post changing from xml to db). You're using ODBC in eventhandlers.vbs, so enabling that in php.ini and using the ODBC driver should work. Not sure why the MySQL connection string isn't working. Is that maybe COM related? I know your db is on another machine. I don't know. I'm talking out my arse… :mrgreen: But we do know for sure that ODBC works for you.

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-05-01 22:35

palinka wrote:
2020-05-01 21:28
OK, I looked at your event handlers from the previous page (the first post changing from xml to db). You're using ODBC in eventhandlers.vbs, so enabling that in php.ini and using the ODBC driver should work. Not sure why the MySQL connection string isn't working. Is that maybe COM related? I know your db is on another machine. I don't know. I'm talking out my arse… :mrgreen: But we do know for sure that ODBC works for you.
Well... I have two webservers... IIS on Windows has NO problems with PDO but access is blocked from Internet... Apache on LINUX have problems with PDO and is my public/general Webserver.

Roundcube, WordPress and some other stuff I have on Apache work perfectly with MySQL and MySQLi.

RoundCube on Apache/Linux forward COM requests to code on my IIS (Tunis made the drivers).

So... How should you know that :mrgreen:
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-01 22:46

SorenR wrote:
2020-05-01 22:35

So... How should you know that :mrgreen:
Well, I did say I was talking out my arse. Even the blind golfer hits a hole in one sometimes. :mrgreen:

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-05-02 03:09

Found the bugger...

Seems that the PHP version on my Linux is a bit old... The predefined constant "JSON_PRETTY_PRINT => 128" did not exist before PHP 5.40 and I'm using PHP 5.3.29. Unfortunately it is not possible to upgrade PHP on the (10 year old) NAS so I will probably end up buying a new.

I was getting "PHP Warning: json_encode() expects parameter 2 to be long" in "/var/log/httpd-error-user.log" ...

I replaced "JSON_PRETTY_PRINT" with 128 and that made it work. :mrgreen:
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-03 17:35

SorenR wrote:
2020-05-02 03:09
Found the bugger...

Seems that the PHP version on my Linux is a bit old... The predefined constant "JSON_PRETTY_PRINT => 128" did not exist before PHP 5.40 and I'm using PHP 5.3.29. Unfortunately it is not possible to upgrade PHP on the (10 year old) NAS so I will probably end up buying a new.

I was getting "PHP Warning: json_encode() expects parameter 2 to be long" in "/var/log/httpd-error-user.log" ...

I replaced "JSON_PRETTY_PRINT" with 128 and that made it work. :mrgreen:
Mine is getting a little long in the tooth too. Upgrading means upgrading horde, which I'm dreading. :evil:

ANYWAY.... I just got around to putting the db script into my eventhandlers. I tested with a bunch of messages and knocked out the stupid stuff, but there's one issue I can't figure out.

"ERROR" 13968 "2020-05-03 11:20:30.329" "Script Error: Source: Microsoft VBScript runtime error - Error: 800A1399 - Description: Syntax error in regular expression - Line: 126 Column: 6 - Code: (null)"

Code: Select all

Function oLookup(strRegEx, strMatch, bGlobal)
	If strRegEx = "" Then strRegEx = StrReverse(strMatch)
	With CreateObject("VBScript.RegExp")
		.Pattern = strRegEx
		.Global = bGlobal
		.MultiLine = True
		.IgnoreCase = True
		Set oLookup = .Execute(strMatch)   '<<---- LINE 126
	End With
End Function
I know its not the function, but I can't debug it because whatever syntax error is causing it is obviously getting redefined through the function. Any ideas where to look?

Is it possible that an empty field could cause this? For example, attempting to query against "List-Unsubscribe" when the List-Unsubscribe header does not exist?

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-05-03 21:21

palinka wrote:
2020-05-03 17:35
SorenR wrote:
2020-05-02 03:09
Found the bugger...

Seems that the PHP version on my Linux is a bit old... The predefined constant "JSON_PRETTY_PRINT => 128" did not exist before PHP 5.40 and I'm using PHP 5.3.29. Unfortunately it is not possible to upgrade PHP on the (10 year old) NAS so I will probably end up buying a new.

I was getting "PHP Warning: json_encode() expects parameter 2 to be long" in "/var/log/httpd-error-user.log" ...

I replaced "JSON_PRETTY_PRINT" with 128 and that made it work. :mrgreen:
Mine is getting a little long in the tooth too. Upgrading means upgrading horde, which I'm dreading. :evil:

ANYWAY.... I just got around to putting the db script into my eventhandlers. I tested with a bunch of messages and knocked out the stupid stuff, but there's one issue I can't figure out.

"ERROR" 13968 "2020-05-03 11:20:30.329" "Script Error: Source: Microsoft VBScript runtime error - Error: 800A1399 - Description: Syntax error in regular expression - Line: 126 Column: 6 - Code: (null)"

Code: Select all

Function oLookup(strRegEx, strMatch, bGlobal)
	If strRegEx = "" Then strRegEx = StrReverse(strMatch)
	With CreateObject("VBScript.RegExp")
		.Pattern = strRegEx
		.Global = bGlobal
		.MultiLine = True
		.IgnoreCase = True
		Set oLookup = .Execute(strMatch)   '<<---- LINE 126
	End With
End Function
I know its not the function, but I can't debug it because whatever syntax error is causing it is obviously getting redefined through the function. Any ideas where to look?

Is it possible that an empty field could cause this? For example, attempting to query against "List-Unsubscribe" when the List-Unsubscribe header does not exist?
I get no error if either "strRegEx" or "strMatch" is blank ("")...
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-03 21:47

Weird. For all I know it could be completely unrelated. I'll keep trying later. I'm still getting mail, so it's not critical for the moment.

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-05-03 21:52

palinka wrote:
2020-05-03 21:47
Weird. For all I know it could be completely unrelated. I'll keep trying later. I'm still getting mail, so it's not critical for the moment.
Can you post the RegExp for your List-Unsubscribe?
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-04 14:54

Will do as soon as I sit down at my computer. But in the meantime I thought you'd be interested in this. I'm under attack since Friday night. Didn't even realize it. Fwban sweeping them away easy peasy.
Screenshot_20200504-084529_Brave.jpg
All password guessers. Helo for most of them is [127.0.0.1]
Screenshot_20200504-085100_Brave.jpg
You can have a look for yourself. The firewall ban demo mirrors what I'm actually blocking. It has its own database so there's no effect on my actual installation, so feel free to push buttons. :mrgreen:

https://firewallban.dynu.net/

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-04 15:25

SorenR wrote:
2020-05-03 21:52
palinka wrote:
2020-05-03 21:47
Weird. For all I know it could be completely unrelated. I'll keep trying later. I'm still getting mail, so it's not critical for the moment.
Can you post the RegExp for your List-Unsubscribe?
I only mentioned List-Unsubscribe because I know its a field that is not present in every message. Here's a selection of banhammers from OnAcceptMessage:

Code: Select all

	REM - Reject "List-Unsubscribe:"
	If oMessage.HeaderValue("List-Unsubscribe") <> "" Then
		strRegEx = MyListRegEx(MyListDict, "//Reject/List-Unsubscribe")
		Set oMatchCollection = oLookup(strRegEx, oMessage.HeaderValue("List-Unsubscribe"), False)
		For Each oMatch In oMatchCollection
			Result.Value = 2
			Result.Message = ". 08 Your access to this mail system has been rejected due to the sending MTA's poor reputation. If you believe that this failure is in error, please contact the intended recipient via alternate means."
			Call Disconnect(oClient.IPAddress)
			Call FWBan(oClient.IPAddress, "ListUnsub-Rej", oClient.HELO, PTR_Record)
			Call AutoBan(oClient.IPAddress, "Rejected List Unsubscribe - " & oClient.HELO, 1, "h")
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "ListUnsub-Rej", oClient.IPAddress, oClient.HELO)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgFrom", oClient.IPAddress, oMessage.FromAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgTo", oClient.IPAddress, oMessage.Recipients(0).OriginalAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgSubject", oClient.IPAddress, oMessage.Subject)
			Call ReportToAbuseIPDB(oClient.IPAddress, "11", "Mail Rejected due to Proprietary Method on port " & oClient.Port & ", EHLO: " & oClient.HELO & "From: " & oMessage.FromAddress)
			Set oMatch = Nothing
			Set oMatchCollection = Nothing
			Exit Sub
		Next
	End If

	REM - Reject "X-Envelope-From:"
    strRegEx = MyListRegEx(MyListDict, "//Reject/X-Envelope-From")
    Set oMatchCollection = oLookup(strRegEx, oMessage.FromAddress, False)
    For Each oMatch In oMatchCollection
		Result.Value = 2
		Result.Message = ". 09 Your access to this mail system has been rejected due to the sending MTA's poor reputation. If you believe that this failure is in error, please contact the intended recipient via alternate means."
		Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "X-Envelope-From", oClient.IPAddress, oClient.HELO)
		Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgFrom", oClient.IPAddress, oMessage.FromAddress)
		Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgTo", oClient.IPAddress, oMessage.Recipients(0).OriginalAddress)
		Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgSubject", oClient.IPAddress, oMessage.Subject)
		Call ReportToAbuseIPDB(oClient.IPAddress, "11", "Mail Rejected due to Proprietary Method on port " & oClient.Port & ", EHLO: " & oClient.HELO & "From: " & oMessage.FromAddress)
        Set oMatch = Nothing
        Set oMatchCollection = Nothing
		Exit Sub
	Next

	REM - Additional SPAM processing
	Dim Done : Done = False
	If (oMessage.HeaderValue("X-hMailServer-Spam") = "YES") Then Done = True
	Do Until Done
		REM - Blacklist "IPRange:"
		strRegEx = MyListRegEx(MyListDict, "//Blacklist/IPRange")
		Set oMatchCollection = oLookup(strRegEx, oClient.IPAddress, False)
		For Each oMatch In oMatchCollection
			Call MyListStat(MyListDict, oMatch)
			Call BlackList(oMessage, "//Blacklist/IPRange = '" & oMatch.Value & "'", 5)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "BL-IP", oClient.IPAddress, oMatch.Value)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgFrom", oClient.IPAddress, oMessage.FromAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgTo", oClient.IPAddress, oMessage.Recipients(0).OriginalAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgSubject", oClient.IPAddress, oMessage.Subject)
			Set oMatch = Nothing
			Set oMatchCollection = Nothing
			Exit Do
		Next
		REM - Blacklist "X-Envelope-From:"
		strRegEx = MyListRegEx(MyListDict, "//Blacklist/X-Envelope-From")
		Set oMatchCollection = oLookup(strRegEx, oMessage.FromAddress, False)
		For Each oMatch In oMatchCollection
			Call MyListStat(MyListDict, oMatch)
			Call BlackList(oMessage, "//Blacklist/X-Envelope-From = '" & oMatch.Value & "'", 5)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "BL-EnvFrom", oClient.IPAddress, oMatch.Value)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgFrom", oClient.IPAddress, oMessage.FromAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgTo", oClient.IPAddress, oMessage.Recipients(0).OriginalAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgSubject", oClient.IPAddress, oMessage.Subject)
			Set oMatch = Nothing
			Set oMatchCollection = Nothing
			Exit Do
		Next
		REM - Blacklist "From:"
		strRegEx = MyListRegEx(MyListDict, "//Blacklist/From")
		Set oMatchCollection = oLookup(strRegEx, oMessage.From, False)
		For Each oMatch In oMatchCollection
			Call MyListStat(MyListDict, oMatch)
			Call BlackList(oMessage, "//Blacklist/From = '" & oMatch.Value & "'", 5)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "BL-From", oClient.IPAddress, oMatch.Value)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgFrom", oClient.IPAddress, oMessage.FromAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgTo", oClient.IPAddress, oMessage.Recipients(0).OriginalAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgSubject", oClient.IPAddress, oMessage.Subject)
			Set oMatch = Nothing
			Set oMatchCollection = Nothing
			Exit Do
		Next
		REM - Blacklist "Subject:"
		strRegEx = MyListRegEx(MyListDict, "//Blacklist/Subject")
		Set oMatchCollection = oLookup(strRegEx, oMessage.Subject, False)
		For Each oMatch In oMatchCollection
			Call MyListStat(MyListDict, oMatch)
			Call BlackList(oMessage, "//Blacklist/Subject = '" & oMatch.Value & "'", 5)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "BL-Subject", oClient.IPAddress, oMatch.Value)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgFrom", oClient.IPAddress, oMessage.FromAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgTo", oClient.IPAddress, oMessage.Recipients(0).OriginalAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgSubject", oClient.IPAddress, oMessage.Subject)
			Set oMatch = Nothing
			Set oMatchCollection = Nothing
			Exit Do
		Next
		REM - Blacklist Body (Plain Text)
		strRegEx = MyListRegEx(MyListDict, "//Blacklist/Bodytxt")
		Set oMatchCollection = oLookup(strRegEx, oMessage.Body, False)
		For Each oMatch In oMatchCollection
			Call MyListStat(MyListDict, oMatch)
			Call BlackList(oMessage, "//Blacklist/Body = '" & oMatch.Value & "'", 5)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "BL-Bodytxt", oClient.IPAddress, oMatch.Value)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgFrom", oClient.IPAddress, oMessage.FromAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgTo", oClient.IPAddress, oMessage.Recipients(0).OriginalAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgSubject", oClient.IPAddress, oMessage.Subject)
			Set oMatch = Nothing
			Set oMatchCollection = Nothing
			Exit Do
		Next
		REM - Blacklist Body (HTML)
		REM - 
		REM -  <!-- ... -->   PHP: "(<!--[^>]*-->)"      JavaScript: "(<!--[\s\S]*?-->)"
		REM -  /*   ...  */   PHP: "(\/\*)[^>]*(\*\/)"   JavaScript: "(\/\*)[\s\S]*?(\*\/)"
		REM -  <!--[\\s\\S]*?(?:-->)?<!---+>?|<!(?![dD][oO][cC][tT][yY][pP][eE]|\\[CDATA\\])[^>]*>?|<[?][^>]*>?
		REM - 
		Dim strHTMLBody : strHTMLBody = oMessage.HTMLBody
		With CreateObject("VBScript.RegExp")
			.Pattern = "(\/\*[\s\S]*?\*\/)|(<[\s\S]*?>)"
			.Global = True
			.MultiLine = True
			.IgnoreCase = True
			strHTMLBody = .Replace(strHTMLBody, "")
		End With
		Set oMatchCollection = oLookup(strRegEx, strHTMLBody, False)
		For Each oMatch In oMatchCollection
			Call MyListStat(MyListDict, oMatch)
			Call BlackList(oMessage, "//Blacklist/Body = '" & oMatch.Value & "'", 5)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "Bodytxt", oClient.IPAddress, oClient.HELO)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgFrom", oClient.IPAddress, oMessage.FromAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgTo", oClient.IPAddress, oMessage.Recipients(0).OriginalAddress)
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "REJECTED", "MsgSubject", oClient.IPAddress, oMessage.Subject)
			Exit Do
		Next
		Done = True
	Loop

	If (oMessage.HeaderValue("X-hMailServer-Spam") = "YES") Then
		REM - Whitelist "X-Envelope-From:"
		strRegEx = MyListRegEx(MyListDict, "//Whitelist/X-Envelope-From")
		Set oMatchCollection = oLookup(strRegEx, oMessage.FromAddress, False)
		For Each oMatch In oMatchCollection
			Call MyListStat(MyListDict, oMatch)
			Call WhiteList(oMessage, "//Whitelist/X-Envelope-From = '" & oMatch.Value & "'")
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "Accepted", "WL-EnvFrom", oClient.IPAddress, oMatch.Value)
			Set oMatch = Nothing
			Set oMatchCollection = Nothing
		Next
		REM - Whitelist "From:"
		strRegEx = MyListRegEx(MyListDict, "//Whitelist/From")
		Set oMatchCollection = oLookup(strRegEx, oMessage.From, False)
		For Each oMatch In oMatchCollection
			Call MyListStat(MyListDict, oMatch)
			Call WhiteList(oMessage, "//Whitelist/From = '" & oMatch.Value & "'")
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "Accepted", "WL-From", oClient.IPAddress, oMatch.Value)
			Set oMatch = Nothing
			Set oMatchCollection = Nothing
		Next
		REM - Whitelist "Subject:"
		strRegEx = MyListRegEx(MyListDict, "//Whitelist/Subject")
		Set oMatchCollection = oLookup(strRegEx, oMessage.Subject, False)
		For Each oMatch In oMatchCollection
			Call MyListStat(MyListDict, oMatch)
			Call WhiteList(oMessage, "//Whitelist/Subject = '" & oMatch.Value & "'")
			Call AccRejDB(msgID, oClient.Port, "OnAcceptMessage", "Accepted", "WL-Subject", oClient.IPAddress, oMatch.Value)
			Set oMatch = Nothing
			Set oMatchCollection = Nothing
		Next
	End If

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-04 15:39

Duhhhhh!!!! I looked at the Function MyListRegEx to see about writing to the event log. Of course it was already there. :oops:

Checked the event log and found this repeated many times.

12036 "2020-05-04 09:14:03.591" "ERROR: Empty string from MyListRegEx(Ransomeware, Bodytxt)"

I think I found it. You spelled "Ransomware" wrong, so I changed it throughout. Missed one. :oops: :oops: :oops:

Well, we found out one thing. If you're going to test against a "trunk" or "branch" in the database, you better make sure they exist and are spelled correctly. :mrgreen:

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-04 15:47

OOPs spoke too soon. I just sent a test message and got the same original error:

"ERROR" 12036 "2020-05-04 09:44:22.451" "Script Error: Source: Microsoft VBScript runtime error - Error: 800A1399 - Description: Syntax error in regular expression - Line: 126 Column: 2 - Code: (null)"

No error in the event log for this message. :(

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-05-04 16:39

Microsoft VBscript runtime error (0x800A1399) --> regular expression syntax error
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-04 22:28

SorenR wrote:
2020-05-04 16:39
Microsoft VBscript runtime error (0x800A1399) --> regular expression syntax error
See my code above. Everything looks OK to me. Maybe I screwed up something accidentally in the functions? I had to make changes to account for the db column name changes. Maybe I accidentally deleted something or whatever? Do you see anything?

I set up a test script with bare bones functionality. Function MyListRegEx seems to be working. I have some wscript.echos set up to see what works and the regex string appears to be working (several items from the db separated by pipe "|").

At this point, I think it may be simply vbs not being able to process certain regex types although I haven't narrowed it down to which entries are problematic.

https://stackoverflow.com/questions/347 ... e-800a1399

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-04 22:34

In my test script of Blacklist/Subject, I got the regex syntax error. As soon as I removed (deactivated) these 3 entries, the test script worked.

(^((?:yo|hi|sup|hello|greets|hey t?here)!?.?8?-?)?)$)
(^(cialis|viagara|erectile)(!?)(.?)(8?-?)?)?$)
(iPhone\s?(?:3G|4|5|6|SE|7|8|9|X|11)?(?:C|S|R)?\s?(?:Plus)?(?:Pro)?\s?(?:Max)?)

What is it about these entries that cause the regex to fail?

Can you replicate?

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-05-04 22:39

palinka wrote:
2020-05-04 22:34
In my test script of Blacklist/Subject, I got the regex syntax error. As soon as I removed (deactivated) these 3 entries, the test script worked.

(^((?:yo|hi|sup|hello|greets|hey t?here)!?.?8?-?)?)$)
(^(cialis|viagara|erectile)(!?)(.?)(8?-?)?)?$)
(iPhone\s?(?:3G|4|5|6|SE|7|8|9|X|11)?(?:C|S|R)?\s?(?:Plus)?(?:Pro)?\s?(?:Max)?)

What is it about these entries that cause the regex to fail?

Can you replicate?
... Hmm...
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-05-04 23:04

Code: Select all

(iPhone\s?(?:3G|4|5|6|SE|7|8|9|X|11)?(?:C|S|R)?\s?(?:Plus)?(?:Pro)?\s?(?:Max)?) - Confirmed.

(^((?:yo|hi|sup|hello|greets|hey t?here)!?.?8?-?)?)$) - Yours
^((?:yo|hi|sup|hello|greets|hey t?here)!?.?8?-?\)?)$ - Mine ... Confirmed

NB: "8?-?\)?" = 8-) You removed the "\" in "\)"

I presume it is the same case with this: 
(^(cialis|viagara|erectile)(!?)(.?)(8?-?)?)?$)

It really should be
(^(cialis|viagara|erectile)(!?)(.?)(8?-?\)?)?$)
Did you convert the database from XML ???
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-05 02:56

SorenR wrote:
2020-05-04 23:04
Did you convert the database from XML ???
Convert? What is this strange concept you speak of? :mrgreen:

Actually, I used the regex replace in notepad++ to change the xml entries to csv, then imported to MySQL using a powershell script. I assumed MySQL added any necessary escaping during the insert commands. I didn't really scrutinize it after it was added.

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-05 03:08

SorenR wrote:
2020-05-04 23:04

Code: Select all

(iPhone\s?(?:3G|4|5|6|SE|7|8|9|X|11)?(?:C|S|R)?\s?(?:Plus)?(?:Pro)?\s?(?:Max)?) - Confirmed.
Did you convert the database from XML ???
OK, plugged this (above) in and manually escaped the "\" and now its working. :oops:

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-05-05 09:26

palinka wrote:
2020-05-05 03:08
SorenR wrote:
2020-05-04 23:04

Code: Select all

(iPhone\s?(?:3G|4|5|6|SE|7|8|9|X|11)?(?:C|S|R)?\s?(?:Plus)?(?:Pro)?\s?(?:Max)?) - Confirmed.
Did you convert the database from XML ???
OK, plugged this (above) in and manually escaped the "\" and now its working. :oops:
There are probably more of the same if I remember correctly. I did a manual conversion - changed the XML file in NP++ to become a CSV file and imported it into MySQL. Ended up with two "windows" comparing the XML version and the DB version.

I used this when logging the XML data to my database to make sure everything was escaped properly.

Code: Select all

Function xmlStats(strXML)
    Dim strSQL, oDB
    Set oDB = GetDatabaseObject
    strXML = Replace(strXML, "",     "\_")
    strXML = Replace(strXML, "\",    "\\")
    strXML = Replace(strXML, "%",    "\%")
    strXML = Replace(strXML, "'",    "\'")
    strXML = Replace(strXML, vbCr,   "\r")
    strXML = Replace(strXML, vbLf,   "\n")
    strXML = Replace(strXML, vbTab,  "\t")
    strXML = Replace(strXML, vbBack, "\b")
    strXML = Replace(strXML, Chr(34),"\" & Chr(34))
    strSQL = "INSERT INTO hm_xmlstat (created,timestamp,xmlnode,hits) VALUES (NOW(),NOW(),'" & strXML & "',1) ON DUPLICATE KEY UPDATE timestamp=NOW(),hits=(hits+1);"
    Call oDB.ExecuteSQL(strSQL)
    Set oDB = Nothing
End Function
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-05 14:07

SorenR wrote:
2020-05-05 09:26
There are probably more of the same if I remember correctly. I did a manual conversion - changed the XML file in NP++ to become a CSV file and imported it into MySQL. Ended up with two "windows" comparing the XML version and the DB version.

I used this when logging the XML data to my database to make sure everything was escaped properly.

Code: Select all

Function xmlStats(strXML)
    Dim strSQL, oDB
    Set oDB = GetDatabaseObject
    strXML = Replace(strXML, "",     "\_")
    strXML = Replace(strXML, "\",    "\\")
    strXML = Replace(strXML, "%",    "\%")
    strXML = Replace(strXML, "'",    "\'")
    strXML = Replace(strXML, vbCr,   "\r")
    strXML = Replace(strXML, vbLf,   "\n")
    strXML = Replace(strXML, vbTab,  "\t")
    strXML = Replace(strXML, vbBack, "\b")
    strXML = Replace(strXML, Chr(34),"\" & Chr(34))
    strSQL = "INSERT INTO hm_xmlstat (created,timestamp,xmlnode,hits) VALUES (NOW(),NOW(),'" & strXML & "',1) ON DUPLICATE KEY UPDATE timestamp=NOW(),hits=(hits+1);"
    Call oDB.ExecuteSQL(strSQL)
    Set oDB = Nothing
End Function
👍

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-05 21:45

I went back to my original php thing. I wasn't happy with how the js one jumps around. Edit something and it immediately goes back to the full list, so you have to search again, etc...

I made some changes. First of all, its really for mobile, so that's why the columns look the way they do. I also fixed up the drop down boxes to narrow down search options. Unfortunately, to get to the narrowed list of branch options, you first need to click search. Hey, its not js…

Also, edit/del is a new window. After you make edit or delete, the edit/del window closes and the main window, being the last one opened before edit/del, is what you go back to, but you need to refresh to see the changes you made. However, because it uses GET, refreshing the main window keeps you right where you were with respect to search, pagination, etc.

Anyway, I like it better. Mainly because its mobile friendly.
Attachments
black_white_admin_mobile.rar
(7.23 KiB) Downloaded 30 times

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-07 14:16

Do you see any difference between "Ransomware" and "Extortion"?

I guess the question is: is it worth the extra dozen or so lines of script to create a Function Extortion? I see them as being more or less the same.

Great idea, by the way, to pick up the SA headers for the extortion tags.

User avatar
SorenR
Senior user
Senior user
Posts: 3625
Joined: 2006-08-21 15:38
Location: Denmark

Re: Dynamic Black/Whitelists in your script.

Post by SorenR » 2020-05-07 15:30

palinka wrote:
2020-05-07 14:16
Do you see any difference between "Ransomware" and "Extortion"?

I guess the question is: is it worth the extra dozen or so lines of script to create a Function Extortion? I see them as being more or less the same.

Great idea, by the way, to pick up the SA headers for the extortion tags.
Ransomware was ment to catch ... well ... Ransom virus code.

Extortion I am nowhere near finished with yet. The filtering of charactersets and look-a-like lettering I am still working on.

Work in progress...

Code: Select all

Function TXTDecode(strTXT)
    '
    '   Decode HTMLBody
    '
    With CreateObject("VBScript.RegExp")
        .Global = True
        .MultiLine = True
        .IgnoreCase = True
        .Pattern =          "(&#x392;)|(\u0392)" : strTXT = .Replace(strTXT, "b")
        .Pattern = "(&#205;)|(&#x399;)|(\u0399)" : strTXT = .Replace(strTXT, "I")
        .Pattern =          "(&#x3B1;)|(\u03B1)" : strTXT = .Replace(strTXT, "a")
        .Pattern =          "(&#x3B2;)|(\u03B2)" : strTXT = .Replace(strTXT, "B")
        .Pattern = "(&#328;)|(&#x3B7;)|(\u03B7)" : strTXT = .Replace(strTXT, "n")
        .Pattern = "(&#237;)|(&#x3B9;)|(\u03B9)" : strTXT = .Replace(strTXT, "i")
        .Pattern =          "(&#x3BA;)|(\u03BA)" : strTXT = .Replace(strTXT, "k")
        .Pattern =          "(&#x3BD;)|(\u03BD)" : strTXT = .Replace(strTXT, "v")
        .Pattern =          "(&#x3BF;)|(\u03BF)" : strTXT = .Replace(strTXT, "o")
        .Pattern =          "(&#x3C1;)|(\u03C1)" : strTXT = .Replace(strTXT, "p")
        .Pattern =          "(&#x3C4;)|(\u03C4)" : strTXT = .Replace(strTXT, "t")
        .Pattern = "(&#252;)"                    : strTXT = .Replace(strTXT, "u")
        .Pattern = "(&#356;)"                    : strTXT = .Replace(strTXT, "T")
        .Pattern = "(\=[\r\n])"                  : strTXT = .Replace(strTXT, "")
        .Pattern = "(<font color=""white"">[a-z0-9]+<\/font>)" : strTXT = .Replace(strTXT, " ")
    End With
    TXTDecode = strTXT
End Function
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

palinka
Senior user
Senior user
Posts: 1968
Joined: 2017-09-12 17:57

Re: Dynamic Black/Whitelists in your script.

Post by palinka » 2020-05-07 15:35

SorenR wrote:
2020-05-07 15:30
Extortion I am nowhere near finished with yet. The filtering of charactersets and look-a-like lettering I am still working on.
Feels like Christmas getting near! :mrgreen:

Post Reply