Search found 221 matches

by eliassal
2020-02-18 16:12
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Isn't GROUP BY syntax the same for MySQL and MSSQL? Anyway, that's a remnant from when I was querying hm_fwban_rh. I'll remove it even though it shouldn't hurt anything. You can group a single return value as well as multiple ones. No it is not possible with sql, here is the error that you get Msg 8...
by eliassal
2020-02-18 16:10
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

So in this case there will be no records in the other 2 ytables if it is enetered by VBS then processed and deleted by ban script, am i correct?
by eliassal
2020-02-18 14:46
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Comment on error and see if it produces an error log entry.
I did , there was no error logged in hmailserver
I stopped/restarted hMailServer and it is working now and I got an entry in the hm-ids table with hit = 1
by eliassal
2020-02-18 14:37
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

some new issues I discovered this morning 1 - This cant run in sql, I commented GROUP BY ipaddress in order to make it work SELECT hits AS returnhits, ipaddress FROM hm_fwban_blocks_ip -- GROUP BY ipaddress In page repeatsview.php, line 22 should be chanqed as well to accomodate with sql if ($search...
by eliassal
2020-02-18 14:35
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Palinka, please, you did not respond to one of my questions I asked yesterday when running the hmsFirewallBan.ps1 but not inserting any record in hm-ids table, the script works fine now and it inserts records in 2 tables but not hm-ids table, here is the question again. Did I misunderstand something...
by eliassal
2020-02-18 14:28
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

OK, I will check and let you know, lets assume everything working fine and we have a record inserted in hm-ids table, then the ps script runs in 5 minutes, find a record in this table with more than 2 hits, it creates the rule then delete the record from it without any record for the IP in the 2 tab...
by eliassal
2020-02-18 14:12
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Yes agre understood this, please see my precedent email, in spite of failure nothing is logged, in VBS I saw you always do
On error resume next
and on error goto 0
but no writing to a log file or ...
by eliassal
2020-02-18 14:08
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Palinka, can you please tell me how to trace what is happening in the VBS file. In hmailserver log I see "TCPIP" 5768 "2020-02-18 11:24:23.963" "TCP - 87.245.132.52 connected to 192.168.1.34:25." "DEBUG" 5768 "2020-02-18 11:24:23.963" "Executing event OnClientConnect" "DEBUG" 5768 "2020-02-18 11:24:...
by eliassal
2020-02-18 13:32
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Palinka, can you please let me know which part inserts records in the hm_ids table? VBS in hmailserver or the powershell script "hmsFirewallBan.ps1"?
by eliassal
2020-02-18 13:31
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

OK, I replaced the whole code in commoncode, it is working now
by eliassal
2020-02-18 02:13
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

$( DBFormatDate (DBCastDateTimeFieldAsDate 'timestamp') '%Y') AS year,
...

in the hmsUpdateChartTables.ps1
by eliassal
2020-02-18 02:00
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

in hmsFirewallBan.ps1 there is no code to populate ids table $FirewallLogObjects | foreach-object { If (($_.Action -match 'DROP') -and ($_.DestinationPort -match $MailPorts) -and ($_.SourceIP -notmatch $LSRegex)) { $IP = $_.SourceIP $DateTime = $_.Date + " " + $_.Time If ($DatabaseType -eq "MYSQL"){...
by eliassal
2020-02-18 01:31
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

I will stop for tonight as I worked a lotm the eqrlier version did not have so many sql statements issues :(
by eliassal
2020-02-18 01:29
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

In scriptm hits per daym it generates a sql query SELECT a.daily, a.year, a.month, a.day, a.ipperday, b.blockperday FROM ( SELECT CAST(timestamp AS DATE) AS daily, FORMAT(CAST(timestamp AS DATE), 'System.Collections.Hashtable[%Y]' , 'en-US') AS year, (FORMAT(CAST(timestamp AS DATE), 'System.Collecti...
by eliassal
2020-02-18 00:36
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

I forgot to mention that the field timestamp in hm_fwban_blocks_ip should be changed to datetime otherwise insert will error
by eliassal
2020-02-18 00:34
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Here you records in hm_fwban_blocks_ip and hm_fwban_rh tqbles but nothing in hm_ids. In section ####################################### # # # IDS # # (Intrusion Detection System) # # # ####################################### you query hm_ids as follows $Query = "SELECT ipaddress, country FROM hm_ids...
by eliassal
2020-02-17 23:07
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

OK please let me know once it is done as nothing is getting to my tables not from the PS ban script nor the hMailserver VBS
by eliassal
2020-02-17 23:00
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

This is very old way of processing such topic, There is a much better and neat way using "MERGE" Keyworg which does UpSert . either insert if record does not exist or update any other field if reord exists, somthing similar to this (this very quick and dirty example to show you) MERGE hm_fwban_block...
by eliassal
2020-02-17 21:32
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Panilka, in hmsFirewallBan.ps1 section ####################################### # # # FIREWALL LOG PARSING # # # ####################################### there is a sql query as follows $Query = "INSERT INTO hm_fwban_blocks_ip (ipaddress, hits, lasttimestamp) VALUES ('$IP',1,'$DateTime') ON DUPLICATE ...
by eliassal
2020-02-17 20:52
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

tell me why in table hm_fwban_rh, the field is of type timestamp like the other fields in the other timesatamp fields in other tables whgic are of datetime type
Thios can generate issues
by eliassal
2020-02-17 20:09
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

OK thanks for both answers, I will continue discovering the tool
by eliassal
2020-02-17 19:29
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

and here is the code for the commoncode.ps1 <# _ _ _ _ _ _ _ ____ ____ ____ _ _ ____ ____ |__| |\/| /_\ | | [__ |___ |__/ | | |___ |__/ | | | |/ \| |___ ___] |___ | \ \/ |___ | \ ____ _ ____ ____ _ _ _ _ _ _ ___ _ _ _ |___ | |__/ |___ | | | /_\ | | |__] /_\ |\ | | | | \ |___ |_|_|/ \|___ |___ |__]/ ...
by eliassal
2020-02-17 19:28
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Here is the code for hmsFirewallBanDBSetup.ps1 <# _ _ _ _ _ _ _ ____ ____ ____ _ _ ____ ____ |__| |\/| /_\ | | [__ |___ |__/ | | |___ |__/ | | | |/ \| |___ ___] |___ | \ \/ |___ | \ ____ _ ____ ____ _ _ _ _ _ _ ___ _ _ _ |___ | |__/ |___ | | | /_\ | | |__] /_\ |\ | | | | \ |___ |_|_|/ \|___ |___ |__...
by eliassal
2020-02-17 19:25
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

so Palinke, I did everyhting from scratch, tables are created , events are working fine in hMaiserver, I dumped the data in the tables before starting from scratch, I am thinking of populating the ids table manullay then fire hmsFirewallBan.ps1, of course I will take care of having those tables clea...
by eliassal
2020-02-17 18:43
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Lot of issues in the new hmsFirewallBanDBSetup.ps1 and CommonCode.ps1 Bugs 1 -No need for the word "port=" in the connection string ;port=" + $SQLPort, only ,number ,427 2 - what is this for in mssql runquery which I commented [void][System.Reflection.Assembly]::LoadWithPartialName("MySql.Data") 3 -...
by eliassal
2020-02-17 17:56
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Palinka, there is a typo in the script commoncode.ps1

Code: Select all

Function RunSQLQuery($Query){
    If ($DatabaseType -eq "MYSQL") {
        MySQLQuery($Query)
    } ElseIf ($DatabaseType -eq "MSSQL"){
        [b]MySQLQuery[/b]($Query)
    } Else {
        Out-Null
    }
}
by eliassal
2020-02-17 17:46
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

I solved the strange issue, the file was blocked, I unblocked it
Any reason this specific security on this file?
by eliassal
2020-02-17 17:38
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Ok, don't worry, I downlaoded your version, deleted old tables, I noticed the existance of the new variable which I repalced with my iis path as follows $wwwFolder = "P:\inetpub\wwwroot\PHPBanAdmin" I have just tried to run the hmsFirewallBanDBSetup.ps1 script but getting a strange behavior, it is a...
by eliassal
2020-02-17 16:28
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Oh my god, I was at
https://github.com/lcamilo/hMailServer-Firewall-Ban

all files I used where downloaded from there
by eliassal
2020-02-17 14:24
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Palinka, it is the same exact code that I have for creating the tables, only 3 tables and 1 function, here is the copy from Githyub, no new table and ptr field is already there, github says the file was updated 6 days ago If ($DatabaseType -eq "MSSQL") { # Create hm_fwban table if it doesn't exist $...
by eliassal
2020-02-17 13:46
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Today I uploaded a "major" change to github. I suggest starting from scratch since there is a new database table plus one altered table. There's no point in trying to use the upgrade scripts when you have very little data and you never really got started with it anyway. Palinka, I visited the githu...
by eliassal
2020-02-17 02:20
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

You did not answer this question
Should the site runs on the server where hMailServer is running in order the site works correctly or can we run it from anywhere?
by eliassal
2020-02-17 02:18
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Do you mean a php function or T-SQL function?
by eliassal
2020-02-17 02:17
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

ok, i will write the function tomorow
I have tested like operator with versions 2005, 2008, 2008R2, 2012, 2014 and 2016. I will check if it is the same thing for version 2017 and 2019
by eliassal
2020-02-17 02:06
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

I will stop now, go to bed, time to sleep, my wife shouting :D
I will continue tomorrow. Tell me where are based, in Europe or US?
by eliassal
2020-02-17 02:05
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Also as a general note, Stored procedures are more efficient and easy to maintain than T-sql statements distributed in all pages, much more pefrormant andm make code more easy to read
by eliassal
2020-02-17 01:56
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

search was returning nothing, I fixed it. in sql server "Like operator" does not work with columns of type Datetime, it should be converted to a string, I replaced the line WHERE timestamp LIKE '%{$search}%' by WHERE (convert(nvarchar(50), timestamp, 126) LIKE '%{$search}%' or CONVERT(VARCHAR, DateT...
by eliassal
2020-02-17 01:51
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Palinka, Clicking on "IDS" link. I find 2 records 1 with 8 hits. How can I ban the one with 8 hits from web site? Or it should be through Powershell script?, can you give me an idea on the workflow for each function (link) Should the site runs on the server where hMailServer is running in order the ...
by eliassal
2020-02-17 00:32
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Wooooooow, I discovered the issue, my bad On MS site, I did not notice that there is versions when having php7.dll or php7ts.dll (I really don't know what or from where this php 7ts .dll come fom) 64-bit php_sqlsrv_72_nts.dll 64-bit php_pdo_sqlsrv_72_nts.dll 7.2 no Use with 64-bit php7.dll 64-bit ph...
by eliassal
2020-02-16 20:57
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Yes the demo is working fine I should say that it is very nice and useful, we see good ideas behind the desihgner :wink: I activated debug on the php.ini, now I can this error Parse error: syntax error, unexpected '$pdo' (T_VARIABLE), expecting ',' or ';' in C:\inetpub\wwwroot\PHPBanAdmin\functions....
by eliassal
2020-02-16 16:00
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

I tried both versions 5.3 and 7, it is not going through
by eliassal
2020-02-16 15:42
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Also can you please provide a link or info on learning google charts that you are using?
by eliassal
2020-02-16 15:40
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

getting "host cannot be resolved" in the browser.
Is this hosted on a synology NAS?
by eliassal
2020-02-16 15:38
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

I clicked on the link, I got Access forbidden! You don't have permission to access the requested directory. There is either no index document or the directory is read-protected. If you think this is a server error, please contact the webmaster. Error 403 hmsfirewallbandemo.ddns.net Apache/2.4.26 (Wi...
by eliassal
2020-02-16 15:36
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

My first tries were with PHP 7.0
by eliassal
2020-02-16 13:52
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

Palinka, I checked the php version on one of my desktops, I discovered it was 5.3.28. I visited the download page at https://docs.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server?view=sql-server-ver15 thers is The following versions of the drivers for PHP on Windows are available ...
by eliassal
2020-02-16 11:37
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

No a standalone server. Palinka, I am thinking of creating your phpbam in ASP.Net/C#.

Can you provide me screenshots of the php ban pages, also if possible the rules to follow in the functions in a bullteted list
by eliassal
2020-02-15 23:37
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

OK, so I don't know what to do more than this, what do you think?
by eliassal
2020-02-15 21:43
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

what version of PHP you use, in my environment I have
7.0.30
and
5.3.28
In IIS I can switchbetween anyone of them
by eliassal
2020-02-15 21:41
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

There is somthing strange, include files are not gettting executed. I did the fllowing - Created a.php file in this file I put <?php echo "file <br />"; ?> I add an include in index.php can see it in the as follows include_once 'config.php'; include_once 'functions.php'; include_once 'a.php'; I see ...
by eliassal
2020-02-15 21:20
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

do you want me to revert to version 5.0.3?
by eliassal
2020-02-15 21:20
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

7.0.3. I started debugging with my little knowledge, in fact the site is not reaching rhe Functions.php. I added this if( $pdo ) { echo "Connection established.<br />"; }else{ echo "Connection could not be established.<br />"; die( print_r( sqlsrv_errors(), true)); } nothing happens, only blank page...
by eliassal
2020-02-15 20:46
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

I hard coded the connection, same result, blank page. I triggered SQL profiler, the web site is not reaching the sql server
by eliassal
2020-02-15 20:41
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

my hMailsServer is 5.6.6-B2383
by eliassal
2020-02-15 20:40
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

yes, SQL\SC2K12, it is correct as this is not the default instance. IN sql world, you can have a default instance and as much as other instances, each instance is an independant sql server but running on the same server except that they use dynamic ports and not like th edefault which listens on por...
by eliassal
2020-02-15 18:06
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

how can we debug this? I am not well versed with php
by eliassal
2020-02-15 18:05
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

well I added the foloowing 2 lines in the php.ini
extension=php_sqlsrv_7_ts.dll
extension=php_pdo_sqlsrv_7_ts.dll
error disappeared but I am getting a blank page
by eliassal
2020-02-15 17:12
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

for the web sit even after setting the driver, I am still getting the same error, here is what i have in my php.config $Database = array ( 'dbtype' => 'mssql', 'host' => 'SQL\SC2K12', 'username' => 'myuserrun', 'password' => 'myuserrun', 'dbname' => 'hmailserver', 'driver' => 'mssql', 'port' => '492...
by eliassal
2020-02-15 16:15
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

I solved the sql truncation issue, I dont know why the field ipaddres was created with varchar(1)
by eliassal
2020-02-15 15:48
Forum: General discussions
Topic: Block IPs
Replies: 265
Views: 107547

Re: Block IPs

OK, I have already downloaded 7.3 for the record I got, Powershell correctly created the firewall rule but was not able to insert the record in hwban table, after debugging I saw this error in sql, I will investigate, have you seen this? INSERT INTO hm_fwban (timestamp,ipaddress,ban_reason,country,f...