AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sparrow: AHK WebServer w/ AHK in HTML support (sources incl)
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
twhyman



Joined: 07 Dec 2005
Posts: 339

PostPosted: Fri May 22, 2009 6:19 am    Post subject: Reply with quote

Happy happy day!

Sparrow lives on!

Great job!
_________________
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message
Kudos



Joined: 21 Aug 2006
Posts: 30

PostPosted: Fri May 22, 2009 8:30 am    Post subject: Reply with quote

I think Sparrow is just brilliant! I'm using it for SW copy protection online registrations. Love it.

http://www.autohotkey.com/forum/viewtopic.php?p=270416#270416
Back to top
View user's profile Send private message
derRaphael



Joined: 23 Nov 2007
Posts: 841
Location: ~/.

PostPosted: Fri May 22, 2009 8:24 pm    Post subject: Reply with quote

hey kudos! your idea for sw copy protection sounds good to me.

if you want to, you can write a quick use case example in sparrow's wiki, so others might benefit from that idea.

also everybody else who uses sparrow in a more or less productive way is asked to write about it so ppl see how an ahk based webserver can be used. just write about your expiriences using sparrow.

thanks in advance

dR
_________________

    All scripts, unless otherwise noted, are hereby released under CC-BY
Back to top
View user's profile Send private message
Fry



Joined: 01 Nov 2007
Posts: 885

PostPosted: Tue May 26, 2009 12:47 am    Post subject: Reply with quote

Truly Great Software!

I have a question though, how can I use HKML fiels to get data out fields and input in a txt file
Back to top
View user's profile Send private message
Kudos



Joined: 21 Aug 2006
Posts: 30

PostPosted: Tue May 26, 2009 1:46 am    Post subject: Reply with quote

Here is a quick example. Sorry for the messy code. I'll try to give more details later.

keygen.hkml

Code:
<?ahk
#Include SWProtect-Internal.ahk

; Initialize the secret seeds
SWP_Initialize(0x12345678, 0x12345678)   ; with optional 8 secret seeds

; Read the values
AppName := $_GET[AppName]
Version := $_GET[Version]
Name := $_GET[Name]
Email := $_GET[Email]
Fingerprint := $_GET[Fingerprint]
IP := $_GET[IP]

; Generate a key for me
Key := SWP_GenerateKey(Name, Email, Fingerprint )

; Test if user details are valid - disabled as always false for me.
; UserOK := SWP_IsUserAuthenticated(Name, Email, Key )

; Remove %20 from fields
StringReplace, Name, Name,`%20, %a_space%  , All
StringReplace, AppName, AppName,`%20, %a_space%  , All

; Record to the log file
FileAppend, %Name%`,%Email%`,%Fingerprint%`,%Key%`,%AppName%`,%Version%`,%IP%`n, Registrations.txt

; Return the generated key
echo(Key)

soundbeep
?>


Subroutine I added to SWProtect-GUI.ahk
Code:

RegURL = http://xxxxx.webhop.org:81/keygen.hkml

SWP_ActivateOnline:

URLDownloadToFile,http://www.netikus.net/show_ip.html, %A_ScriptDir%\showip.txt
if !ErrorLevel = 1
{
   FileReadLINE,Mainip,%A_ScriptDir%\showip.txt, 1
   FileDelete, showip.txt
}

URLDownloadToFile,http://www.xxxxx.com/sendemail.php?Name=%SwpGuiVal_Name%&Email=%SwpGuiVal_Email%&Fingerprint=%SwpGuiVal_Fingerprint%&AppName=%AppName%&Version=%Version%&IP=%Mainip%, %a_temp%\sendemail.txt
if !ErrorLevel = 1
   FileDelete, %a_temp%\sendemail.txt
   
URL = %RegURL%?Name=%SwpGuiVal_Name%&Email=%SwpGuiVal_Email%&Fingerprint=%SwpGuiVal_Fingerprint%&AppName=%AppName%&Version=%Version%&IP=%Mainip%
URLDownloadToFile, %URL%, %a_temp%\result.txt
;run,%a_temp%\result.txt
If Errorlevel
{
   MsgBox 48, Server unreachable, Activation server could not be reached`, please Send an email to the author.
   SWP_ShowGetKeyDialog()
}
Else
{
   FileReadLine,SwpGuiVal_Key,%a_temp%\result.txt, 1
   ;run, %a_temp%\result.txt
   Gui %SWP_GuiID%:Destroy
   Gosub, SWP_RegisterDialogOk
}
Return
Back to top
View user's profile Send private message
Voltron43



Joined: 27 Mar 2009
Posts: 76
Location: Dublin, IE

PostPosted: Sat Jun 20, 2009 8:23 pm    Post subject: Reply with quote

I'm looking to remotely start and close uTorrent from work and I've come across a few options. I could use a third party program such as A-A-S (I'd rather stick with AHK), remotely access my computer (blocked from work), SSL (which I don't want to nor know how to set up on my computer at home), use ManaUser's TCP/IP based remote control (can't figure out how to use it behind the proxy at work), so I've decided to use the GET or POST method with Sparrow in conjunction with httpQuery which supports proxy connections.

My main concern now is to minimize the amount of code needed on the host/server side. So my question is as follows: what can I rip out/leave out of Sparrow and still get the POST/GET method to work?

My test hkml file is as follows:
Code:
<html>
    <head>
        <title>uTorrent Status</title>
    </head>
    <body>
        <?ahk
            Process, Exist, uTorrent.exe
            sStat := ErrorLevel
            head_b1[1] := "1"   ; Start uTorrent
            head_b1[0] := "0"   ; Close uTorrent
            head_b1[2] := "-1"  ; Status only
            ; Define Standard
            If !(IsSet($_GET[var])) ;|| !(RegExMatch(AvailLng,$_GET[var])))
                $_GET[var] := "2"
            FailOverStatus := (!IsSet($_GET[failOver])) ? "0" : $_GET[failOver]
            head_b1 := head_b1[%$_GET[var]%]
            If (StrLen(head_b1) = 0)
                head_b1 := head_b1[%FailOverStatus%]
            If (head_b1 = "1" && sStat = "0")
            {
                Run, %A_ProgramFiles%\uTorrent\uTorrent.exe
                sStat := "1"
            }
            Else If (head_b1 = "0" && sStat != "0")
            {
                Process, Close, uTorrent.exe
                sStat := "0"
            }
            echo("Status|" (sStat = 0 ? "Down" : "Running"))
        ?>
    </body>
</html>

_________________
My Scripts
Back to top
View user's profile Send private message Visit poster's website
diablo7806



Joined: 21 Aug 2007
Posts: 9

PostPosted: Tue Jul 21, 2009 6:16 am    Post subject: Reply with quote

Hey, i posted this in the Ask for Help area, but i didnt get any positive replies. So i'll post here, maybe someone can help me.

I'm wanting to make a page in sparrow that monitors my server from the internet. I was wondering if theres any cpu, memory, and maybe temperature monitoring dll calls or something that will work with sparrow,

Also, how would i get an html text input to work on sparrow and submit a variable to be posted to a different page, password protection type of thing.
Back to top
View user's profile Send private message
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Sun Jan 17, 2010 6:30 am    Post subject: compatibility with AutoHotkey_L Reply with quote

I changed all the "[" and "]" in the variable names to "_" and "".
Had to be careful with the regular expressions...
Sparrow now works with AutoHotkey_L: source.
Atleast all the sample hkml pages seem to work.

Edit 1:
more Changes:
1. put get and post variables in local objects.
2. switched to using include scripts instead of running in pipes for hkml scriptlets
3. forked to ahkbb (my working goal for a first app using sparrow)


Last edited by tinku99 on Fri Jan 22, 2010 7:08 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Tue Jan 19, 2010 1:41 am    Post subject: Reply with quote

Great tool, rly.
Thx for making it.
_________________
Back to top
View user's profile Send private message
genmce



Joined: 10 Jan 2009
Posts: 135
Location: Virginia

PostPosted: Wed Jan 20, 2010 3:25 am    Post subject: Reply with quote

DerRaphael wrote:
i thought about it, yes ... atm i am just quite short of time but still ... the idea to have it as a "true" community project is quite tempting.

who wants to contribute with this project, so we can develop a strategy (versioning, publishing/hosting, bugtracking, documentation) ?


Hey this is great!
Have you developed it any further?
_________________
KeyMce/GenMce - mackie emulator for pc keyboard/Convert your controller to mackie.
Midi I/O - Want to play with midi/ahk?
Back to top
View user's profile Send private message Yahoo Messenger
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Fri Jan 22, 2010 4:06 am    Post subject: post problem with chrome Reply with quote

form.hkml example does not seem to work with google chrome...
anyone else have the same issue ?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Sat Jan 23, 2010 11:39 pm    Post subject: using worker thread in autohotkey.dll Reply with quote

sparrow in ahkbb
Changes:
1. moved processrequest to a worker thread
should let sparrow handle a much larger load

2. put post and get variables in an object
should keep variables from getting entangled between clients

Requires AutoHotkey.dll: version L41N10H2, function: asyncFunction(dllname, functionname, parameters.... )

Todo:
1. cookies
2. actual bb code
3. lot more


Last edited by tinku99 on Sun Jan 24, 2010 1:06 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Sun Jan 24, 2010 12:07 am    Post subject: Reply with quote

Sounds very nice.

I am curious, did you do some load tests ?
_________________
Back to top
View user's profile Send private message
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Sun Jan 24, 2010 7:34 am    Post subject: load tests Reply with quote

majkinetor wrote:
Sounds very nice.
I am curious, did you do some load tests ?

Looks like it can handle 7 nearly simultaneous requests when running with 7 worker threads without a problem...
i think the more worker threads, the more it should be able to handle...

requires: 7 copies of AutoHotkey.dll named: AutoHotkey1.dll, AutoHotkey2.dll ...
should be able to use autohotkeymini by hotkeyit i think, but will need to add asyncFunction to it first.

changes:
post method works with plain text in google chrome now.

Issues:
still having problems with multipart post method in chrome... have disabled it for chrome user agent for now.

todo:
bbcode
cookies
authentication
may try it on a temporary public server: please post any security issues that you might know of or find...
Back to top
View user's profile Send private message Send e-mail Visit poster's website
genmce



Joined: 10 Jan 2009
Posts: 135
Location: Virginia

PostPosted: Tue Feb 02, 2010 4:08 am    Post subject: Re: load tests Reply with quote

tinku99 wrote:
majkinetor wrote:
Sounds very nice.
I am curious, did you do some load tests ?

Looks like it can handle 7 nearly simultaneous requests when running with 7 worker threads without a problem...
i think the more worker threads, the more it should be able to handle...

requires: 7 copies of AutoHotkey.dll named: AutoHotkey1.dll, AutoHotkey2.dll ...
should be able to use autohotkeymini by hotkeyit i think, but will need to add asyncFunction to it first.

changes:
post method works with plain text in google chrome now.

Issues:
still having problems with multipart post method in chrome... have disabled it for chrome user agent for now.

todo:
bbcode
cookies
authentication
may try it on a temporary public server: please post any security issues that you might know of or find...


Hey I tested this out and it works great!
How do I use keygen.hkml above with this?
I tried putting it in the www folder but got an error...
_________________
KeyMce/GenMce - mackie emulator for pc keyboard/Convert your controller to mackie.
Midi I/O - Want to play with midi/ahk?
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 6 of 7

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group