AutoHotkey Community

It is currently May 26th, 2012, 9:37 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 103 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next
Author Message
PostPosted: September 24th, 2008, 8:20 am 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
    Sparrow goes community

NEW!! Sparrow wiki
    A wiki for sparrow can be found here: http://sparrow.wikia.com/
    Also sparrow gone SVN (to be found here: svn://autohotkey.net/sparrow/core - a detailed help on howto SVN look here: http://sparrow.wikia.com/wiki/SVN_Howto)

    As many asked if i can make sparrow being a true community project with a decentralized version control system (aka SVN) and a wiki page, well here we go.

    A roadmap will follow

    Interested folks, please drop me either a note or mail me at derRaphael-at-oleco-dot-net so i can setup developer accounts for SVN.

    Also if anybody is interested in contributing (whatever is available, help to spread the word and make sparrow fly) just join me and get a part of the developer crew.

    many different talents are needed such as wiki maintenance, arts, hkml development, html development, bug tracking, support etc etc ...

    Thx
    DerRaphael - May, 20th 2009

AHK Sparrow Initial Release 0.1.3
    Sparrow is a webserver completly written in AHK, which nativly supports AHK scrips being embedded in HTML. So called HKML files (pronounce H-Key-ML). The results are sent back to requested browser.

    Download Sparrow-0.1.3.7z

    The documentation is included in the 7zip file. it'd be too huge to write it all here.

    JumpStart: Download the file, extract it (rename the folder if u like) start the script with the name sparrow.core.ahk open ur browser and type in lh (it autoexpands to http://localhost:81/index.hkml) press enter and enjoy.

    1st AID - Trouble Shooting: Bind to different IP address ... open file sparrow.settings.ahk and look for 0.0.0.0 change it to an IP of your choice (likely 127.0.0.1) also check if port 81 is free might be neccessary to change this one, too (same file) save and restart ( if sparrow is running hit ctrl+f12 to reload the server )

    this script is using named pipes and wont run in windows 9x

    been successfully tested on ahk 1.0.47.5 (winxp sp2) and ahk 1.0.47.6 (win2k sp4) and yes, it does serves pages into the net if u allow it :)
    Note: This version has been reported to work with Vista, too. (Thx, ChalamiuS)

    AHKWebserver Sparrow: here are some teaser Screenshots of the Webserver in action :)

The Start UI
Image
(Welcomescreen)

Example dump
Image
(provoked HKML Script Compilationerror)

Demonstration of Status Overview
Image
(show environment System-Variables)

8)
[/list]

Feedback welcome!

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Last edited by derRaphael on May 22nd, 2009, 1:48 am, edited 7 times in total.

Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 24th, 2008, 8:32 am 
DerRaphael wrote:
Sparrow is a webserver completly written in AHK, which nativly supports AHK scrips being embedded in HTML. So called HKML files (pronounce H-Key-ML). The results are sent back to requested browser.


I think AHK (as a language) is not really suited for writing serious web applications, but the concept is really cool nevertheless.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2008, 8:43 am 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
the goal is to have a usable api, to support AHK Scripts producing native webpages. which comes in handy for scrips, which are in need of remote control. this is a very early alpha state of the software showing - as a proof of concept - that this actually works.

also having smaller sites, which need to run off a webserver, can be realized with this. (like CDROM Productions etc)

it is not meant to replace existing webserver solutions. for a production webserver, i still prefer unixoid based OS instead of windows.

greets
dR

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2008, 9:10 am 
Very cool! 8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2008, 1:28 pm 
Very interesting.

So does this work like a server side VBScript or PHP? Maybe I am wrong in this interpretation. What kind of security does it have? Could you post about its functions too.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2008, 2:18 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
LiquidGravity wrote:
Very interesting.

So does this work like a server side VBScript or PHP? Maybe I am wrong in this interpretation. What kind of security does it have? Could you post about its functions too.


1st of all its a script which is written in pure ahk, running this script, you may access content hosted there by typing http://localhost:81/

There is a Script called "Sparrow.Core.ahk" This one works as the standard webserver, In the server settings you have an option to tell if hkml files being interpreted. when turnoed to on, and being requested from the webserver, it will load the whatvernameithas.hkml file and starts interpreting
its content.

it looks for sections enclosed in <?ahk ?> brackets.

The content of such a tag is - you guess it a plain AHK script. so a basic HKML script would look like this:

Code:
<html>
<head>
  <title>HKML TestFile</title>
</head>
<body>
<?ahk echo("Hello World from AHK embedded in HTML") ?>
</body>
</html>


of course these sections may include more than just one command. you can even use include files - not directly, a particular include directory has to be specified, so a direct access to includefiles is not possible.

atm the server is in a very early stage. the script are not checked. nor is its content. from what i canm say a path traversal hack wont work, but is not fully exploited yet.

each scriplet has a set of one-way global accessible variables. that means, each script gets a fresh copy of selected serverside variables but is not abled to change these back on server. these variables have a $_ prefix and come in different categories:

$_GET variables which include any passed variables sent with teh request
$_POST variables, from any forms uploaded
$_FILES (not fully working atm)
$_SERVER variables which have some vital information like referrer etc.

the server accepts POST and GET requests. File transfers will be possible, but are disabled for now (the server crashes, thats why)

if u ever done something in PHP, you will find, that requests posted (aswell as set via get) are stored flobally in $_GET[Varname] Variables
Same with $_POST[Varname]

On my list i have things like header injection - so the servers header content can be changed from within a script, superglobals - variables, that will be accessible from different code segments on _ONE_ hkml file.

Right now, doing some code like:
Code:
<html>
<head>
  <title>HKML TestFile</title>
</head>
<body>
<?ahk a := 5 ?>
<p>Some HTML content</p>
<?ahk echo(a) ?>
</body></html>


will simply not work - technically these are two scripts and run in seperate adress spaces. i need to resetup my IPC so server works as a variable buffer for scripts. along with that, cookie-session management and header injection will become possible.

php or asp like vbs wont work, unless someone writes a wrapper for that.

i have setup a technical demo, which is also seen from the screenshot above, showing environment variables in a hkml file which were accessed at runtime of the script - not at that from server. besides each script may do whatever AHK script can do. control applications, create GUIS (no these are not send back to client, 'd be cool though ;) ), whatever ... all GUI actions will physically happen on the server. the client only receives the html (content whatever) you sent back to it.

it is not working atm, but i have plans to include a demo showing how to use GDI+ libraries to dynamically create graphics on the fly and send these back to client.

there is a basic interface for a plugin structure but this needs more imporvement, so plugins may be loaded at runtime (enabled or disabled)

so far .. most of the stuff i have written here will also be readable in the documentation which will be accessible from standard welcome page

more to come

greets
DerRaphael

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2008, 4:48 pm 
DerRaphael wrote:
Right now, doing some code like:
Code:
<html>
<head>
  <title>HKML TestFile</title>
</head>
<body>
<?ahk a := 5 ?>
<p>Some HTML content</p>
<?ahk echo(a) ?>
</body></html>


will simply not work - technically these are two scripts and run in seperate adress spaces. i need to resetup my IPC so server works as a variable buffer for scripts. along with that, cookie-session management and header injection will become possible.


I would leave it treat that like two separate scripts and instead use a heredoc method to output the HTML content in between. See http://en.wikipedia.org/wiki/Heredoc#Pr ... _languages

Example:
Code:
<html>
<head>
  <title>HKML TestFile</title>
</head>
<body>
<?ahk a := 5
echo  <<<HERE
<p>Some HTML content</p>
<p>Some more HTML content</p>
HERE;
echo(a) ?>
</body></html>


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2008, 5:04 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
dangit now i have to write a php wrapper
luckily php supports command line html parsing
I will post it later tonight or tomorrow wont take long
i fill approach it as tho the ahk script output is created prior to phpbeing called
thoughts?
probably wrap mysql in it as well ...thoughts on this?

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2008, 5:30 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
implementing heredoc alike techniques wont be possible unless the script parser will be rewritten.

however it is possible using a similar attempt either by using the echo() wrapper or writing directly out to stdout by using fileappend and ahk continuation sections. it will be cleaner using echo(), since fileappend is subject to change in future releases.

currently echo() is a simple wrapper for fileappend and looks like this:
Code:
; This needs to be tested with binary raw data
echo(string,length=0) {
   FileAppend,%string%,*
}

As u can see, there is a length parameter included which might be used for raw binary data lateron

so a translated heredoc attempt using echo 'd look like this:
Code:
<?ahk

a := 5
b=
(LTrim Join<br>`n
What I always wanted to do:

Writing my own webserver, supporting the scripting language of my choice.
<strong>Hey! I did that already!!</strong>
)
echo(b)
echo(a)
?>


i just checked out of curiosity, how continuation sections 'd work directly with parameters when calling a function, here's what i learned
not working
Code:
test(
(Join`n
this
is
a
test
))

test(what)
{
   msgbox %what%
}

working!
Code:
test(
(Join`n
"this
is
a
test"
))

test(what)
{
   msgbox %what%
}



greets
dR

edit added mo' example codes :)

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2008, 6:12 pm 
:shock:

OMG

Thats pretty amazing ! Woot

:wink: Too bad its a teaser yet I would love too play with it.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 25th, 2008, 7:01 pm 
Offline

Joined: June 3rd, 2008, 7:34 pm
Posts: 86
Location: Italy
WTF this is ****' awesome! Nice, nice, nice :D

_________________
All my scripts/snippets are released under the WTFPL: http://sam.zoy.org/wtfpl/COPYING


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 26th, 2008, 4:38 am 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
Image
    Sources released - sorry for delay have had to write at least some docu :D

    boys and girls, have fun with ur new toy!

    u can also click on the image (sparrow logo) to access the download

    greets
    dR

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Last edited by derRaphael on September 26th, 2008, 5:18 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 26th, 2008, 4:55 am 
Offline

Joined: July 15th, 2007, 1:43 am
Posts: 1320
I just love this! I'm going to try to integrate a bunch of functions into it right now.

_________________
Religion is false. >_>


Last edited by trik on September 26th, 2008, 5:26 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 26th, 2008, 5:21 am 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
added a lil download counter .... sorry for any inconvinience :)

greets
dR

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 26th, 2008, 1:26 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
beautiful i will be doing a php module for you i just had a long week

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 103 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, stevep, Stigg and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group