flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Unix > Perl or Asm

Author
Thread Post new topic Reply to topic
iic2



Joined: 26 Jun 2008
Posts: 123
Perl or Asm
For those who don't know me or wonder where I have gone, I worked with delphi than assembler for windows since 1999 as an hobbyist. Than I came up with a decent idea than went to college to study Web Programming, etc. I got all four (A's) and class is over. Well, we never got to the good parts. LOL

From http://en.wikipedia.org/wiki/Wikipedia:Creating_a_bot


Quote:
although it does not display the page on screen, but works on it in memory –

This method, often called screen s*raping, uses the standard HTTP GET protocol: whenever you see /w/index.php?...=...&...=... in the browser address bar, everything after the question mark



All I see is I must study PERL. My question(s) is can I do this in ASM on a freeBSD machine running and updating my web site automatically at mid-night daily. For example, like gathering world-wide weather report or stock-market information that many news papers do hours before hitting the daily press.

I know it's about b*t, sp*ders and ro*ot, but nothing illegal for me but I never tried before and I need to know HOW and if I must use PERL, and if so WHY? If at all possible I rather learn how to do it in assembler for UNIX.

Thanks in advance

PS: It's a sad world when you take a break from ASM. I still can't see it but web programming has been fun but I prefer raw unix and not linux for this type of thing.

I want to come home Sad
Post 14 May 2009, 03:46
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14924
Location: 6EQUJ5

iic2 wrote:
My question(s) is can I do this in ASM on a freeBSD machine running and updating my web site automatically at mid-night daily.

If you can do it in PERL then of course you can do it in ASM. There is no magic in PERL, it all comes down to machine code eventually.
Post 14 May 2009, 06:51
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2149
Location: Estonia
I see all web-development interesting because you must assemble bits from different threads to make your 'code' work with every browser.

With ASM you write and then DEBUG with disassembly. Rinse & repeat Smile
In the web-world you write and then DEBUG in every browser Smile

Sounds very promising project, if you start or are already getting somewhere, please don't hesitate to contact me. I have been dreaming about an A.I., but since I don't have much resources (time & money) at my hands, I can't afford to start a project this huge so the bot-thingy is somewhere in the middle Wink
Post 14 May 2009, 15:19
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
iic2



Joined: 26 Jun 2008
Posts: 123

Quote:
If you can do it in PERL then of course you can do it in ASM. There is no magic in PERL, it all comes down to machine code eventually.



I only been read about perl for a few days (the why and why not's) and no one say or even know about asm. I also know nothing about freeBSD. I only got freeBSD installed and learn how to write one or two sh scripts to back-up rc files. Next step is to learn how to back-up the whole OS on a flash stick. Next step is to make it smaller (mini-bsd). Next step is to learn how to USE IT. heehee Now you see why it took me many years to only learn basic asm. I am soooo slow and life did'nt allow me much spare time.

I have not install any programs yet cause I want to know how to walk the system first and that is very hard to get use to. It been sounding like perl is only a scripting language and do not comply into machine code. So I been hesitate to learn it. That's why I asking about it. Perl also need the wwwlib in-order to build a bot-thingy which make me believe it be hell to try in asm and that c would be the next runner up. I don't want to learn what I don't need. I am spoil. I usually follow suggestion by asm peoples first and they have always won out.

http://www.pageresource.com/cgirec/index2.htm

http://www.perlmonks.org/?node_id=318476



Quote:
In the web-world you write and then DEBUG in every browser



I feel that i wasted two years of my life going to school. They force to use Windows products and Oracle for SQL which run on Windows and Linux. As for server its Windows Server.


Quote:
but since I don't have much resources (time & money) at my hands, I can't afford



I want to learn Unix and MySQL. They are FREE but web programming you have to learn a lot more (PHP,JS,AJAX DOM etc). Time is the problem. I spend all my time getting tricked by all those dumb browser lost in their own c code. They threw in a monkey wrench against each other back-to-back while we suffer. MS is the worse, re-inventing the inch. I did not master cross-bowsing until a few days ago and that came from the help of this site out of thousands I visited. It was a bit*h. Ten time harder than ASM. IE-6 on one machine IE-7 on another, FF Opera, Safari and here comes Google Chrome . I tell you now ... let Fire Fox be the leader and make the other follow as you build. MS (IE) wasted up two years of my life, AGAIN, even in SCHOOL. I only like and need the raw OS and "I have never trust MS products (programs)".

The solution to true cross-browsing is HERE. NO more PX and % where possible.

http://riddle.pl/emcalc/

http://www.astahost.com/info.php/sizes-webdesign-em-vs-px_t8926.html


As of tonight I guest better study the WWWlib and the perlmonk site until I get the WORD. I hate outside programming other that XHTML and AJAX.

Thanks for reading my life story
Hope someone can help
I'll get off my knee now Smile
Post 14 May 2009, 19:30
View user's profile Send private message Reply with quote
iic2



Joined: 26 Jun 2008
Posts: 123
For those who may wish to know, I better include that all of your boxes such as header, footer and container you should use percentage (%) and all of your floats and inner boxes should use (em) as with fonts also as indicated in the link.

It has worked for me and I am still experimenting to be 100% sure to the letter, forever. But this still is not the point of my post.
Post 14 May 2009, 20:53
View user's profile Send private message Reply with quote
pete



Joined: 20 Apr 2009
Posts: 110
Common Gateway Interface using PE console apps
Hello iic2!

PERL is a scripting language, that means the script has to get interpreted by a program and then translated into a machine code, a load of cpu waste if you ask me. So if you want to stick to ASM, "CGI" is the keyword you 're looking for. Here is an example of CGI with an Win32 PE console application, taken from the APJ (Assembler Programming Journal #9) by Michael Pruitt:


Code:

format PE console
entry Start

include '\Asm_Win32\Include\_Kernel.inc'
include '\Asm_Win32\Include\macro\stdcall.inc'
include '\Asm_Win32\Include\macro\import.inc'

   Cr    = 0x0D
   Lf    = 0x0A ;***---------------------------------------------------------------***
section '.code' code readable executable
Start:
    pusha ;Save all of the Registers
    stdcall [GetStdHandle], STD_OUTPUT_HANDLE ;Retrive the actual handle
    mov     [StdOut], eax
    cmp     eaxINVALID_HANDLE_VALUE ;Error with handle
    jz      Exit

Get_Time:
    stdcall [GetSystemTime], Time ;Load SYSTEMTIME with UTC
    call    Format_Time ;Convert Hex(bin) to ascii
                                                 ; and Place into HTML
Write:
    stdcall [WriteFile], [StdOut], HTMLHTML._sizeHTML.Len0 ;Write the HTML to StdOut
Exit:
    popa ;Restore all of the Registers
    stdcall [ExitProcess], 0 ;***-------------------------[Subroutine]--------------------------***
Format_Time:
    mov     ax, [Time.wYear;16b Data
    mov     ediHTML.Date_S + 9 ;Ptr to LAST byte of dest
    call .ascii ;Convert and place into HTML

    mov     ax, [Time.wDay]
    mov     ediHTML.Date_S + 4
    call .ascii

    mov     ax, [Time.wMonth]
    mov     ediHTML.Date_S + 1
    call .ascii

    mov     ediHTML.Day_S ;Destination Ptr
    mov     esiDay.Wk ;Source Ptr (Array of Days)
    xor     eaxeax
    mov     ax, [Time.wDayOfWeek;0 &lt;= eax < 7
    add     esieax                             ;esi =+ eax * 3
    add     esieax                             ; Indexes the Array
    add     esieax
    mov     ecx3                               ;3B per Day String
    cld                                          ;Copy Left to Right
    rep                                          ;    (esi++, edi++)
    movsb

    mov     ax, [Time.wHour]
    cmp     al13                               ;Check for PM
    jl      .wHour
    sub     al12                               ;Correct Hour
    mov     [HTML.Time_S + 9], 'P'               ; AM -> PM .wHour:
    mov     ediHTML.Time_S + 1
    call .ascii

    mov     ax, [Time.wMinute]
    mov     ediHTML.Time_S + 4
    call .ascii

    mov     ax, [Time.wSecond]
    mov     ediHTML.Time_S + 7
    call .ascii
    ret ;***----------------------[Import Table / IAT]---------------------*** .ascii:
    std ;String OPs Right to Left
    cmp     ax10 ;Single Digit?
    jl .onex10

    and     ahah ;Only Two Digits
    jz .twox16

    mov     bh10 ;Reduce 3x16 to 2x16
    div     bh                                   ;  so that AAM can be used
    or      ah0x30 ;BCD -&gt; ASCII
    mov     [edi], ah
    dec     edi .twox16:
    aam                                          ; AH / 10 = AH r AL
    or      al0x30 ;BCD -&gt; ASCII
    stosb
    mov     alah
    cmp     ah9
    jg .twox16 .onex10:
    or      al0x30
    stosb ;Copy Last/Only Digit to Mem
    ret ;***--------------------[Data used by this App]--------------------***
section '.data' data readable writeable
  StdIn         dd 0 ;Standard I/O Handles
  StdOut        dd 0

HTML:
db 'Content-type: text/html'CrLfCrLf
db 'Hello World'CrLf
db '<h1>Hello World</h1>'CrLf
db '<h2>'CrLf
db 'This HTML is dynamicly generated by a PE console Application writen in'
db '80x86 Assembler</h2>'CrLf
db '<h2>It is: ' .Day_S       db 'WkD ' .Date_S      db ' 0/00/0000 ' .Time_S      db ' 0:00:00 AM UTC</h2>'CrLf
                db ''CrLf
HTML._size     = $ - HTML - 1
HTML.Len        dd 0 ;Number of bytes actually wrote

  Time          SYSTEMTIME
  Day.Wk        db 'SunMonTueWedThuFriSat' ;***----------------------[Import Table / IAT]---------------------***
section '.idata' import data readable writeable

library     kernel,             'KERNEL32.DLL'

kernel:
  import    GetModuleHandle,    'GetModuleHandleA',\
            GetCommandLine,     'GetCommandLineA',\
            GetSystemTime,      'GetSystemTime',\
            GetEnvVar,          'GetEnvironmentVariableA',\
            GetStdHandle,       'GetStdHandle',\
            CreateFile,         'CreateFileA',\
            ReadFile,           'ReadFile',\
            WriteFile,          'WriteFile',\
            CloseHandle,        'CloseHandle',\
            ExitProcess,        'ExitProcess'




Be aware that this is not FASM syntax!

Application development with ASM gives you much more freedom than using a scripting language; but with a scripting language you are faster but probably end up by programming senseless/unwanted stuff.

Learning ASM is a great benefit; almost everything can get programmed with it.

I hope this helped!
Post 15 May 2009, 08:46
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14924
Location: 6EQUJ5

pete wrote:
Be aware that this is not FASM syntax!

Could have fooled me, looks to be a very good clone of fasm syntax.
Post 15 May 2009, 09:03
View user's profile Send private message Visit poster's website Reply with quote
iic2



Joined: 26 Jun 2008
Posts: 123

Quote:
This is version for all platforms that have support for the ELF object format and the C library, like OpenBSD or Zeta. The object file provided in this package can be linked with the C library to create the final executable for any such system. The documentation in pure ASCII format is included.



No comment about freeBSD? OpenBSD is based on freeBSD I think. Do this mean It don't work on freeBSD and if it dose.. do we have to add out-side stuff to get it going? If so, what do I have to dig up, please? Cause I may drop down to 4-BSD for size and speed someday. I hope I don't have to jump ship but I will switch to OpenBSD in a spit-sec if freeBSD is too troublesome for FASM. I hope not. But I do need to know about this soon as possible if someone has experience.

Anyway, I scan a lot of stuff about perl last night and it is useful as far as some server work.

There is a thing that can turn a a complete perl script into a C code. Also there is a lot of C build into the perl interpreter itself and I got a feeling that FASM for UNIX darn near do the same thing. I know I am wrong about bot this but its my first thought so this is another question and not a statement.

http://perldoc.perl.org/index-internals.html
http://www.perl.com/pub/a/2001/06/27/ctoperl.html

perl(1) - Link
http://www.tin.org/bin/man.cgi?section=1&topic=perl


WWW::Rob*t rob*t ? - Link
http://www.perlmonks.org/?node_id=318476


HTML META, REL and REV Tags - Link
http://vancouver-webpages.com/META/


List of User-Agents (Spi*ers, Ro*ots, Browser)
http://www.user-agents.org/index.shtml?t_z

IRC b*t written in Perl
http://www.perlbot.org/

B*ts vs Browsers Search Results for "b*t"
http://www.botsvsbrowsers.com/listings.asp?search=bot


Tute 1
http://www.thefreecountry.com/perlscripts/searchengines.shtml

Tute 2
http://www.webreference.com/perl/tutorial/

Tute 22
http://www.webreference.com/perl/tutorial/14/2.html



Now I got a belly ache. And my brain it going poof.

Funny, at this very moment I see this as no big deal outside some serious web-programming work and using what I already know about ASM but must use unix syntax. I must dedicate my few month to BSD and ASM just to get comfortable and turn it into fun and use this bot-thingy as my first project and worry about the rest later.

Spi*ers, Ro*ots what the big deal when all I want to do it grab a simple web page... but differently.. (in SOURCE page form, text not HTML) downloaded to machine at a certain time of each night (A Timer). From there I don't need PERL other than some needed BSD scripting when needed ... I use an ASM program to search for changes in the file comparing it from yesterday source page and store the results somewhere. I can do that much in asm along but I don't know how to the get an HTML source code. Could some one drop a few examples in ASM for Windows. It don't have to work. I just need to see the idea of how it may be build using FASM than I can go from there. I think I done sold myself to take the complete dive and I am not going to chicken out. Black screen is boaring.

Thanks pete for the key-word CGI. That did it for me. I'm going down for count .. FASM on UNIX.


Thank you all
Post 15 May 2009, 22:52
View user's profile Send private message Reply with quote
drhowarddrfine



Joined: 10 Jul 2007
Posts: 538
You want to use wget for downloading your web page and cron to schedule it nightly. Once it's downloaded, you'll have the html and you can scan the source there.

If you want to run a small BSD, look into PicoBSD.
Post 16 May 2009, 04:09
View user's profile Send private message Reply with quote
pete



Joined: 20 Apr 2009
Posts: 110

Quote:

Could have fooled me, looks to be a very good clone of fasm syntax.



Yes, you are right. Probably it's an outmoded version of fasm.
Post 18 May 2009, 10:44
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.