akorx Posted July 10, 2008 Share Posted July 10, 2008 Hi, I'm french and my english is not good (very bad) but i'll try to explain my problem in shakespeare's language : I try to build a script that can warn user that there is a new request on a TCP port. Example : i use vnc on my computer and it's listening on port 5900, but there is no connexion... if one request is incoming i would like to be warn by a script, how can i do it ? it's like a small firewall. Don't laugh against my english, i'm learning and french people are not known to be open to the other language... lol AkorxMail akorx@yahoo.fr Link to comment Share on other sites More sharing options...
herewasplato Posted July 10, 2008 Share Posted July 10, 2008 Show what code you have tried and you might get more help. If you are unsure where to start, maybe the operating system command named Netstat with the "-a" option will give you some ideas. Look at AutoIt's STDIO and array functions.Netstat -aSTDIO to an arrayNetstat -aSTDIO to a second arraycompare arrays looking for a new portYou can search the forums for how others have coded Netstat and STDIO. Here is but one example:http://www.autoitscript.com/forum/index.ph...st&p=487731have fun and enjoy AutoIt :-) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
ptrex Posted July 10, 2008 Share Posted July 10, 2008 @akorxIf you use XP Firewall already. You can start the firewall logging for IN and /or OUT trafic. Based on that logfile you can define some triggers yourselfve.See my Firewall Log Analyzer on how to?regards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
akorx Posted July 16, 2008 Author Share Posted July 16, 2008 This is my script but i don't see how i can threat the cases where i'm using the port 5900 to reach another computer (in this case i don't want to be warn) and there is a computer that is trying to connect to mine (i want to be warn):exemple :-> netstat -an return : TCP myip:1234 205.211.115.27:5900 ESTABLISHED (i'm reaching another computer on port 5900 so i don't want to be warn)-> netstat -an return : TCP myip:5900 205.211.115.28:2125 ESTABLISHED (this is a real connection to my computer on port 5900 and i want to be warn)Do you have an idea ?#include <Array.au3>Opt("ExpandEnvStrings", 1);while 1RunWait(@ComSpec & " /C " & "netstat -an |find ""5900"" > %SystemDrive%\netstat1.tmp")$file = FileReadLine ("%SystemDrive%\netstat1.tmp");MsgBox (0,"",@Tempdir)$part = StringSplit ($file," ");_ArrayDisplay ($part,"tab")_ArraySort( $part);_ArrayDisplay ($part, "sort")$iString = 1While $iString <> 0$iString = _ArrayBinarySearch ( $part, "" )If Not @error Then_ArrayDelete ( $part, $iString)Else $istring =0EndIfWend_ArrayDisplay ($part,"Tab filtré")$result = _ArraySearch($part,"ESTABLISHED")if $result<> -1 Then MsgBox(0,"","Connexion entrante") EndIf;MsgBox (0,"",$result);WEnd AkorxMail akorx@yahoo.fr Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now