Jump to content

NetFlare Web Server (Version 0.3)


Dhilip89
 Share

Recommended Posts

Updated to version 0.2

[u]My Projects[/u]:General:WinShell (Version 1.6)YouTube Video Downloader Core (Version 2.0)Periodic Table Of Chemical Elements (Version 1.0)Web-Based:Directory Listing Script Written In AutoIt3 (Version 1.9 RC1)UDFs:UnicodeURL UDFHTML Entity UDF[u]My Website:[/u]http://dhilip89.hopto.org/[u]Closed Sources:[/u]YouTube Video Downloader (Version 1.3)[quote]If 1 + 1 = 10, then 1 + 1 ≠ 2[/quote]

Link to comment
Share on other sites

Very nice. Just had a quick browse over the code and it was very interesting to read. At first I thought I was stumped at how it worked as the code is spread out, but eventually I found the parsing function.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Great work. How do you retrieve GET and POST data into the autoit-code?

 

Thanks, starting from version 0.3 both GET and POST data is supported.

[u]My Projects[/u]:General:WinShell (Version 1.6)YouTube Video Downloader Core (Version 2.0)Periodic Table Of Chemical Elements (Version 1.0)Web-Based:Directory Listing Script Written In AutoIt3 (Version 1.9 RC1)UDFs:UnicodeURL UDFHTML Entity UDF[u]My Website:[/u]http://dhilip89.hopto.org/[u]Closed Sources:[/u]YouTube Video Downloader (Version 1.3)[quote]If 1 + 1 = 10, then 1 + 1 ≠ 2[/quote]

Link to comment
Share on other sites

Very nice. Just had a quick browse over the code and it was very interesting to read. At first I thought I was stumped at how it worked as the code is spread out, but eventually I found the parsing function.

 

Thank you, it was my random idea then I made this to practice my rusted AutoIt coding skill  :oops:

[u]My Projects[/u]:General:WinShell (Version 1.6)YouTube Video Downloader Core (Version 2.0)Periodic Table Of Chemical Elements (Version 1.0)Web-Based:Directory Listing Script Written In AutoIt3 (Version 1.9 RC1)UDFs:UnicodeURL UDFHTML Entity UDF[u]My Website:[/u]http://dhilip89.hopto.org/[u]Closed Sources:[/u]YouTube Video Downloader (Version 1.3)[quote]If 1 + 1 = 10, then 1 + 1 ≠ 2[/quote]

Link to comment
Share on other sites

Check out version 0.3

Added stress test animation (in GIF)

Edited by Dhilip89

[u]My Projects[/u]:General:WinShell (Version 1.6)YouTube Video Downloader Core (Version 2.0)Periodic Table Of Chemical Elements (Version 1.0)Web-Based:Directory Listing Script Written In AutoIt3 (Version 1.9 RC1)UDFs:UnicodeURL UDFHTML Entity UDF[u]My Website:[/u]http://dhilip89.hopto.org/[u]Closed Sources:[/u]YouTube Video Downloader (Version 1.3)[quote]If 1 + 1 = 10, then 1 + 1 ≠ 2[/quote]

Link to comment
Share on other sites

  • 2 years later...

Hi. Thank you very much for such a great UDF. For me it is magic :)

I wonder If I set the port to say

HttpServer_SetPort(8080)

Then I have to access to my local website from http://127.0.0.1:8080 address. The same would happen with external ips http.xx.xx.xx.xx:8080

How should I configure the port so that I could have a direct access to http://127.0.0.1?

Great thanx in advance!

Link to comment
Share on other sites

 

How should I configure the port so that I could have a direct access to http://127.0.0.1?

Great thanx in advance!

Are you asking if you could connect to 127.0.0.1 from the internet? If you are, the answer is, you can't it is impossible. 127.0.0.1 is a local loopback address only.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

BrewManNH

 I know that 127.0.0.1 is a localhost. The thing is- when I am trying to open the website localy - shows only blank page. If I set the port to 8080 then I get the access only if I navigate it this way: 127.0.0.1:8080 - then the web page opens normally. The same happens when I navigate it somewhere from internet. Say I would have an Ip something like 123.123.123.123 Then when I navigate it directly 123.123.123.123- nothing happens. But when I navigate it 123.123.123.123:8080 The website opens ok from Internet.

 

Link to comment
Share on other sites

80 is the default HTTP port, so I would guess you'd set it to that instead of 8080.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Dear coders

I  really like this UDF, because it is opening really huge possibilities: We are not dependant on php and other "officialy" accepted scripts and languages for web.

Important thing, what about security? I mean, is it secure for injections and other things, which hackers use against websites?

Great thanx in advance

Link to comment
Share on other sites

Dear coders

I  really like this UDF, because it is opening really huge possibilities: We are not dependant on php and other "officialy" accepted scripts and languages for web.

Important thing, what about security? I mean, is it secure for injections and other things, which hackers use against websites?

Great thanx in advance

I hope the IP change I suggested worked for your setup

As far as hackers ... I don't know how to say it. This script will not give you SSL, so, all you have is plain text , anyone logging packets can see the conversation between server and client. As far as SQL injections, that has to do with SQL

I run a web server written in autoit that I use as a log dumper of sorts. My programs send an encrypted string and I process that. If I was to write it now, I'd use an Apache server and PHP.

Play around, hack yourself your script and have fun learning everything you can about anything that can be done in that arena. I know of no other way.

exploits_of_a_mom.png

 

Edited by argumentum
added the pic.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

Argumentum, thank you very much for your comment. The picture is quite descriptive :)

@IP 0.0.0.0 didnt work for me at least on my pc, but I am going to test in other pc to see the final result

@hacking etc. I would like to clearfy my question: Is the server secure for calculations which autoit is doing on the server? For example from the client side I send some post request  to server. The server receives it and then it makes some calculations on the side of autoit $a+$b=$c and many other autoit functions and then it sends to client ok, $c=2345. The question is: Can client interfere into those calculations which autoit is doing on the server. For example by navigating to website using some code like "www.website.com: msgbox (0, "", "hacked")" (I am using a pseudocode of course, but I think you get the idea)?

Great thanx in advance!

Link to comment
Share on other sites

Argumentum, thank you very much for your comment. The picture is quite descriptive :)

@IP 0.0.0.0 didnt work for me at least on my pc, but I am going to test in other pc to see the final result

@hacking etc. I would like to clearfy my question: Is the server secure for calculations which autoit is doing on the server? For example from the client side I send some post request  to server. The server receives it and then it makes some calculations on the side of autoit $a+$b=$c and many other autoit functions and then it sends to client ok, $c=2345. The question is: Can client interfere into those calculations which autoit is doing on the server. For example by navigating to website using some code like "www.website.com: msgbox (0, "", "hacked")" (I am using a pseudocode of course, but I think you get the idea)?

Great thanx in advance!

the answer to A+B=C question is no. No one can run stuff on your PC that you don't code for, ..then again if you use something like $c = execute($a+$b) then you are coding with the possibility of malicious code run, now if you do like $c = Int($a) + Int($b) is known that can not bring harm. So getting hacked is relative to how you code and nothing more.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

...From a quick glance to the source, it seems that the autoit code embedded in the web page is executed on the server one line at a time. See the Aup_Execute() function within the Lib\WebAupProcessor.au3 script. Don't know if this is a good way to embed code within the source web page . Maybe it would be better to be able to execute entire snippets instead of single lines at a time. Executing only single lines of code will limit your programming possibilities.
You will be bound not to use constructs like "for ... next" for example, and other similar restrictions.
Have also a look to this other embrional example on how to embed AutoIt code in web pages and execute it on the server using this other Web Server

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

tell you what. Try some this. a php file 

<?php
    foreach($_SERVER as $key => $value) {
    //putenv('php_SERVER__'.$key.'='. bin2hex($value) );
        if(strpos($key, 'HTTP') === 0) {
            putenv('php_SERVER__'.$key.'='. bin2hex($value) ); // or just these
        }
    }
    foreach($_POST as $key => $value) {
        putenv('php_POST__'.$key.'='. bin2hex($value) );
    }
    foreach($_GET as $key => $value) {
        putenv('php_GET__'.$key.'='. bin2hex($value) );
    }
    foreach($_COOKIE as $key => $value) {
        putenv('php_COOKIE__'.$key.'='. bin2hex($value) );
    }
    $time_start = microtime(true);
    passthru('C:\xampp\cgi-bin\test1.exe');
    $time_end = microtime(true);
    print "<b>PHP Execution Time:</b> ". number_format(($time_end - $time_start) * 1000) ." mSec.<br>\r\n" ;
?>

and a CUI compiled AutoIt, like:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <WinAPI.au3>
#include <WinAPIMisc.au3>

Local $t = TimerInit()

ConsoleWrite("<b>AutoIt Macros:</b><br>" & @CRLF)
fShowAvailableMacros()

ConsoleWrite("<br><b>Environment Strings:</b><br>" & @CRLF)
_WinApi_GetEnvironmentStringsA()

ConsoleWrite('<br>AutoIt Execution Time: ' & Round(TimerDiff($t)) & ' mSec.<br>' & @CRLF)

Func fShowAvailableMacros()
    Local $aMacros[111 - 6] = [110 - 6, _
            "@AppDataCommonDir", _
            "@AppDataDir", _
            "@AutoItExe", _
            "@AutoItPID", _
            "@AutoItVersion", _
            "@AutoItX64", _
            "@COM_EventObj", _
            "@CommonFilesDir", _
            "@Compiled", _
            "@ComputerName", _
            "@ComSpec", _
            "@CPUArch", _
            "@DesktopCommonDir", _
            "@DesktopDepth", _
            "@DesktopDir", _
            "@DesktopHeight", _
            "@DesktopRefresh", _
            "@DesktopWidth", _
            "@DocumentsCommonDir", _
            "@error", _
            "@exitCode", _
            "@exitMethod", _
            "@extended", _
            "@FavoritesCommonDir", _
            "@FavoritesDir", _
            "@GUI_CtrlHandle", _
            "@GUI_CtrlId", _
            "@GUI_DragFile", _
            "@GUI_DragId", _
            "@GUI_DropId", _
            "@GUI_WinHandle", _
            "@HomeDrive", _
            "@HomePath", _
            "@HomeDrive.", _
            "@HomeShare", _
            "@HotKeyPressed", _
            "@HOUR", _
            "@IPAddress1", _
            "@IPAddress2", _
            "@IPAddress3", _
            "@IPAddress4", _
            "@KBLayout", _
            "@LocalAppDataDir", _
            "@LogonDNSDomain", _
            "@LogonDomain", _
            "@LogonServer", _
            "@MDAY", _
            "@MIN", _
            "@MON", _
            "@MSEC", _
            "@MUILang", _
            "@MyDocumentsDir", _
            "@NumParams", _
            "@OSArch", _
            "@OSBuild", _
            "@OSLang", _
            "@OSServicePack", _
            "@OSType", _
            "@OSVersion", _
            "@ProgramFilesDir", _
            "@ProgramsCommonDir", _
            "@ProgramsDir", _
            "@ScriptDir", _
            "@ScriptFullPath", _
            "@ScriptDir", _
            "@ScriptName", _
            "@ScriptLineNumber", _
            "@ScriptName", _
            "@SEC", _
            "@StartMenuCommonDir", _
            "@StartMenuDir", _
            "@StartupCommonDir", _
            "@StartupDir", _
            "@SW_DISABLE", _
            "@SW_ENABLE", _
            "@SW_HIDE", _
            "@SW_LOCK", _
            "@SW_MAXIMIZE", _
            "@SW_MINIMIZE", _
            "@SW_RESTORE", _
            "@SW_SHOW", _
            "@SW_SHOWDEFAULT", _
            "@SW_SHOWMAXIMIZED", _
            "@SW_SHOWMINIMIZED", _
            "@SW_SHOWMINNOACTIVE", _
            "@SW_SHOWMINIMIZED,", _
            "@SW_SHOWNA", _
            "@SW_SHOW,", _
            "@SW_SHOWNOACTIVATE", _
            "@SW_SHOWNORMAL,", _
            "@SW_SHOWNORMAL", _
            "@SW_UNLOCK", _
            "@SystemDir", _
            "@TempDir", _
            "@TRAY_ID", _
            "@TrayIconFlashing", _
            "@TrayIconVisible", _
            "@UserName", _
            "@UserProfileDir", _
            "@WDAY", _
            "@WindowsDir", _
            "@WorkingDir", _
            "@YDAY", _
            "@YEAR"]

    For $n = 1 To 5 ; $aMacros[0]
        ConsoleWrite($aMacros[$n] & '&nbsp;=&nbsp;&gt;' & Execute($aMacros[$n]) & '&lt;<BR>' & @CRLF)
    Next
    ConsoleWrite('.. etc.<BR>' & @CRLF)
EndFunc   ;==>fShowAvailableMacros

Func _WinApi_GetEnvironmentStringsA() ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms683187(v=vs.85).aspx
    ; https://www.autoitscript.com/forum/topic/178400-windows-environment-variables-viewer/
    Local $pEnvBlock, $iPtrStringLen, $tEnvString, $aSplit, $aRet, $sEnvString, $aEnvString[0][2]
    $aRet = DllCall('kernel32.dll', 'ptr', 'GetEnvironmentStringsA') ; GetEnvironmentStringsA returns OEM characters.
    If @error Then Return SetError(@error, @extended, '')
    $pEnvBlock = $aRet[0] ; pointer to a block of memory that contains the environment variables.
    If Not IsPtr($pEnvBlock) Then Return SetError(-1, 0, '')
    While 1
        $iPtrStringLen = _WinAPI_StringLenA($pEnvBlock)
        If $iPtrStringLen > 0 Then
            $tEnvString = DllStructCreate('char[' & $iPtrStringLen + 1 & ']', $pEnvBlock)
            $sEnvString = _WinAPI_OemToChar(DllStructGetData($tEnvString, 1)) ; Convert Oem to Ansi.
            If StringLeft($sEnvString, 1) <> '=' Then
                $aSplit = StringSplit($sEnvString, '=', 1 + 2)
                If Not @error Then
                    ReDim $aEnvString[UBound($aEnvString) + 1][2]
                    $aEnvString[UBound($aEnvString) - 1][0] = $aSplit[0] ; name
                    $aEnvString[UBound($aEnvString) - 1][1] = $aSplit[1] ; value
                    If StringInStr( $aSplit[0] , "php_") == 1 Then
                        ConsoleWrite($aSplit[0] & '&nbsp;=&nbsp;&gt;' & BinaryToString('0x'&$aSplit[1]) & '&lt;<BR>' & @CRLF) ; <----- added just to show the PHP thing
                    Else
                        ;ConsoleWrite($aSplit[0] & ' = ' & $aSplit[1] & '<BR>' & @CRLF) ; <----- added just to show the PHP thing
                    EndIf
                EndIf
            EndIf
            $pEnvBlock += $iPtrStringLen + 1
        Else
            _WinApi_FreeEnvironmentStringsA($pEnvBlock) ; Free memory block.
            $tEnvString = 0
            Return SetError(0, 0, $aEnvString)
        EndIf
    WEnd
EndFunc   ;==>_WinApi_GetEnvironmentStringsA

Func _WinApi_FreeEnvironmentStringsA($pEnv) ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms683151(v=vs.85).aspx
    Local $aRet = DllCall('kernel32.dll', 'int', 'FreeEnvironmentStringsA', 'ptr', $pEnv)
    If Not @error And $aRet[1] <> 0 Then Return SetError(0, @extended, $aRet[1])
    Return SetError(@error, 0, 0)
EndFunc   ;==>_WinApi_FreeEnvironmentStringsA

and see if that's good for you. It worked just fine on my PC and I can have SSL from whatever Apache uses for SSL

Edit: tweaked the code to have the server pass info. that you'll use in your script via environment variables, so you can do:
http://localhost/test1.php?val1=this1&val2=this Other Thing
as GET or make a form and use POST
 

Edited by argumentum
tweaked the code

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...