HAL9000 Posted August 24, 2008 Posted August 24, 2008 how to create a similar software with autoithttp://faltronsoft.org/index.php?option=co...2&Itemid=28
zFrank Posted August 24, 2008 Posted August 24, 2008 (edited) not same but you can block the sites by checking their title and close them with a message. a example: CODE: AutoIt Opt("WinTitleMatchMode", 2) While 1 If WinExists("MyTitle") Then WinClose("MyTitle") MsgBox(0, "Blocked", "You can not view this site") EndIf WEnd or if you have many sites to block then use then CODE: AutoIt Opt("WinTitleMatchMode", 2) $Title = "SiteTitle1|new|warcraft|GSM|Love|" ; you can add many titles like this. $Title &= "software|news|YouTube|video|Name|" $Title &= "ItsLast|" ;$Title is case-insensitive like "YouTube" will match on youtube,YOUTUBE etc $A = 1 While $A < 3 $B = 1 While $B < 580 Sleep(1000) ;it will check every second If WinExists("[REGEXPTITLE:(?i)" & $Title & "]") Then WinClose("[last]") EndIf WEnd WEnd if it is not what you want to do then explain what you really want to do. Edited August 24, 2008 by zFrank [font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php$Life = "Happy" If @Error Then $Life = "Risk"
James Posted August 24, 2008 Posted August 24, 2008 Would be better to get the URL of the site you are visiting. I would help, but I don't know how to sorry. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
HAL9000 Posted August 24, 2008 Author Posted August 24, 2008 host block notifier shows a message when you try to visit a site blocked by the hosts filei want to create a script to do the same thingIf you are using hosts file to block bad hosts (malware, advertisements, etc.), you are directing the system to point to the local machine. The web browser will just show a message to tell you that it couldn't connect to the server or the page cannot be displayed.Host Block Notifier is a little tool that acts like a local web server.Your browser will inform you whenever you access a blocked website. You will need to leave this program running in the background.
Richard Robertson Posted August 24, 2008 Posted August 24, 2008 That's easy. Just write a small http server and set it to listen on 127.0.0.1.
Kip Posted August 24, 2008 Posted August 24, 2008 That's easy. Just write a small http server and set it to listen on 127.0.0.1.Excellent idea. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
James Posted August 24, 2008 Posted August 24, 2008 But how do you make it know which websites are being looked at ? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Richard Robertson Posted August 24, 2008 Posted August 24, 2008 That's sent as part of the host information. It's all part of the http header.
James Posted August 24, 2008 Posted August 24, 2008 That's sent as part of the host information. It's all part of the http header.Ahh I see. Well I think I will have a go at this ^^ Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Kip Posted August 25, 2008 Posted August 25, 2008 Or you just put it it the host file like this: 127.0.0.1/mywebsite.com mywebsite.com or: 127.0.0.1/page.php?url=mywebsite.com mywebsite.com MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Kip Posted August 25, 2008 Posted August 25, 2008 (edited) That's sent as part of the host information. It's all part of the http header.And which part would that be? A small example: [just run this script > browse to "http://127.0.0.1/" or "http://localhost/" with your webbrowser, and tadaaa! ] expandcollapse popupTCPStartup() $iServer = TCPListen("127.0.0.1",80) $sPage = "<b>Hello you!</b><p>You have been redirected to this page because this site is blocked by your host file. <br>"& _ "If you have totally no clue of whats happening here, your brother/sister is probably messing with you. :P"& _ "<p><p><i><font color=red>Made by Kip</font></i>" $CurrentClient = 0 While 1 $iClient = TCPAccept($iServer) if $iClient <> -1 Then $CurrentClient = $iClient EndIf $sRecv = TCPRecv($CurrentClient,1024) If $sRecv Then HttpSend($CurrentClient, $sPage) EndIf WEnd TCPShutdown() Func HttpSend($iClientW, $sText) Local $sHeader = "HTTP/1.1 200 OK" &@CRLF& _ "Date: Mon, 23 May 2005 22:38:34 GMT" &@CRLF& _ "Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)" &@CRLF& _; I know: wrong "Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT" &@CRLF& _; Wrong too "Accept-Ranges: bytes" &@CRLF& _ "Content-Length: "&StringLen($sText) &@CRLF& _ "Content-Type: text/html"&@CRLF&@CRLF Return TCPSend($iClientW,$sHeader&$sText) EndFunc Edited August 25, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Kip Posted August 25, 2008 Posted August 25, 2008 (edited) Better version: allows to download other files than the index page (pictures, videos, audio), and replaces %ascii codes with their characters (%20 = space) This actually is a basic web server. (in just 100 lines ) expandcollapse popupGlobal $DefaultFile = "Index.html" TCPStartup() $iServer = TCPListen("127.0.0.1",80) $CurrentClient = 0 While 1 $iClient = TCPAccept($iServer) if $iClient <> -1 Then $CurrentClient = $iClient EndIf $sRecv = TCPRecv($CurrentClient,1024) If $sRecv Then $Split = StringSplit($sRecv,@CRLF) $FirstLine = $Split[1] $Get = StringReplace($FirstLine,"GET /","") $Get = StringReplace($Get," HTTP/1.1","") $iPos = 1 While 1 $Occ = StringInStr($Get,"%",2,$iPos) If not $Occ Then ExitLoop $HexVal = StringMid($Get,$Occ+1,2) $Get = StringReplace($Get,"%"&$HexVal,Chr("0x"&$HexVal)) $iPos += 1 WEnd If not $Get Then $Get = $DefaultFile $File = FileOpen($Get,16) $sPage = BinaryToString(FileRead($File)) FileClose($File) $Split = StringSplit($Get,".") $Ext = $Split[$Split[0]] Switch $Ext Case "png" $ContentType = "image/png" Case "bmp" $ContentType = "image/bmp" Case "asf" $ContentType = "video/x-ms-asf" Case "avi" $ContentType = "video/avi" Case "doc" $ContentType = "application/msword" Case "zip" $ContentType = "application/zip" Case "xls" $ContentType = "application/vnd.ms-excel" Case "gif" $ContentType = "image/gif" Case "jpg", "jpeg" $ContentType = "image/jpeg" Case "wav" $ContentType = "audio/wav" Case "mp3" $ContentType = "audio/mpeg3" Case "mpg", "mpeg" $ContentType = "video/mpeg" Case "rtf" $ContentType = "application/rtf" Case "htm", "html" $ContentType = "text/html" Case "asp" $ContentType = "text/asp" case Else $ContentType = "text/html" EndSwitch HttpSend($CurrentClient, $sPage, $ContentType) EndIf WEnd TCPShutdown() Func HttpSend($iClientW, $sText, $CT) Local $sHeader = "HTTP/1.1 200 OK" &@CRLF& _ "Server: Kip server" &@CRLF& _ "Accept-Ranges: bytes" &@CRLF& _ "Content-Length: "&StringLen($sText) &@CRLF& _ "Content-Type: "&$CT&@CRLF&@CRLF Return TCPSend($iClientW,$sHeader&$sText) EndFunc Edited August 26, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
dandymcgee Posted August 26, 2008 Posted August 26, 2008 Lol cool, a web server in AutoIt. - Dan [Website]
spudw2k Posted August 26, 2008 Posted August 26, 2008 I like, very simple. I'll probably use this to ties my home webcams together at a central page. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
HAL9000 Posted August 26, 2008 Author Posted August 26, 2008 expandcollapse popupGlobal $DefaultFile = "Index.html" dim $i_PID ProcessSetPriority(@AutoItPID, 0) TCPStartup() $iServer = TCPListen("127.0.0.1",80) $CurrentClient = 0 While 1 sleep(1) $memo = ProcessGetStats(@AutoItPID) if $memo[0]>1000000 then ReduceMemory() $iClient = TCPAccept($iServer) if $iClient <> -1 Then $CurrentClient = $iClient EndIf $sRecv = TCPRecv($CurrentClient,1024) If $sRecv Then $Split = StringSplit($sRecv,@CRLF) $FirstLine = $Split[1] $Get = StringReplace($FirstLine,"GET /","") $Get = StringReplace($Get," HTTP/1.1","") $iPos = 1 While 1 $Occ = StringInStr($Get,"%",2,$iPos) If not $Occ Then ExitLoop $HexVal = StringMid($Get,$Occ+1,2) $Get = StringReplace($Get,"%"&$HexVal,Chr("0x"&$HexVal)) $iPos += 1 WEnd If not $Get Then $Get = $DefaultFile $File = FileOpen($Get,16) $sPage = BinaryToString(FileRead($File)) FileClose($File) $Split = StringSplit($Get,".") $Ext = $Split[$Split[0]] Switch $Ext Case "png" $ContentType = "image/png" Case "bmp" $ContentType = "image/bmp" Case "asf" $ContentType = "video/x-ms-asf" Case "avi" $ContentType = "video/avi" Case "doc" $ContentType = "application/msword" Case "zip" $ContentType = "application/zip" Case "xls" $ContentType = "application/vnd.ms-excel" Case "gif" $ContentType = "image/gif" Case "jpg", "jpeg" $ContentType = "image/jpeg" Case "wav" $ContentType = "audio/wav" Case "mp3" $ContentType = "audio/mpeg3" Case "mpg", "mpeg" $ContentType = "video/mpeg" Case "rtf" $ContentType = "application/rtf" Case "htm", "html" $ContentType = "text/html" Case "asp" $ContentType = "text/asp" case Else $ContentType = "text/html" EndSwitch HttpSend($CurrentClient, $sPage, $ContentType) EndIf WEnd TCPShutdown() Func HttpSend($iClientW, $sText, $CT) Local $sHeader = "HTTP/1.1 200 OK" &@CRLF& _ "Server: Kip server" &@CRLF& _ "Accept-Ranges: bytes" &@CRLF& _ "Content-Length: "&StringLen($sText) &@CRLF& _ "Content-Type: "&$CT&@CRLF&@CRLF Return TCPSend($iClientW,$sHeader&$sText) EndFunc Func ReduceMemory() If $i_PID <> -1 Then Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', @AutoItPID) Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0]) DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0]) Else Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1) EndIf Return $ai_Return[0] EndFunc;==> ReduceMemory()
dandymcgee Posted August 26, 2008 Posted August 26, 2008 It's been done before.I most certainly do not doubt that. I just haven't happened to see it, it's been a while since I've visited the forums hehe. - Dan [Website]
Richard Robertson Posted August 27, 2008 Posted August 27, 2008 Yeah, I noticed your return a few days ago.There's an AutoIt web server that I've recommended some people to.I know it's old, but http://www.autoitscript.com/forum/index.php?showtopic=36845 is a good example.
Kip Posted August 27, 2008 Posted August 27, 2008 I know it's old, but http://www.autoitscript.com/forum/index.php?showtopic=36845 is a good example.It's the best web server written in autoit. I don't know any other. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
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