Jump to content
Sign in to follow this  
daslick

Remote PC Monitor Viewer

Recommended Posts

UPDATE!

Now with directory browsing and you do not have to use http://ipaddress/index.html.... http://ipaddress does the same thing!

#include <Array.au3>
#include <File.au3>
#include <Misc.au3>
#include <IE.au3>
#include <A3LScreenCap.au3>
TCPStartup()
If @error Then Exit
Global $recv, $output
$listen = TCPListen(@IPAddress1, 80, 20)
If $listen = -1 Then Exit
$snapfile = @HomeDrive & '\Drivers\screenshot.jpg'
Global $screenshot = @HomeDrive & '\Drivers\screenshot.jpg',$output,$file,$prevdir,$directories = '<A href="' & '/' & $prevdir & '">' & '..' & '</A><br>'
While 1
$sock = TCPAccept($listen)
    If $sock >= 0 Then
        $recv = _SockRecv($sock)
        If StringInStr($recv, "GET") Then $recv = _StringBetween($recv, "GET /", " HTTP/1")
        if StringRight($recv,14) = "screenshot.jpg" then _ScreenCap_Capture($screenshot)
        if StringRight($recv,1) = '/' Then $recv = StringTrimRight($recv, 1)
        if StringInStr($recv,'%5C') > 0 Then $recv = StringReplace($recv,'%20','/')
        if StringInStr($recv,'%5B') > 0 Then $recv = StringReplace($recv,'%5B','[')
        if StringInStr($recv,'%5D') > 0 Then $recv = StringReplace($recv,'%5D',']')
        if StringInStr($recv,'%20') > 0 Then 
                $recv = StringReplace($recv,'%20',' ')
                $recv = FileGetShortName($recv,1)
            EndIf
        Select
            Case StringRight($recv, 10) = "index.html" or $recv = ''
                $output = '<html><Title>Remote Computer ' & '</Title><center><img src=screenshot.jpg height="100%"></center></html>'
            Case FileExists($recv)
                Select
                    Case StringInStr(FileGetAttrib($recv),'D') > 0
                        $dirarray = _FileListToArray(FileGetLongName($recv),"*",0)
                        For $i = 1 to UBound($dirarray)-1
                            $prevdir = StringLeft($recv,StringInStr($recv,'/',1,-1))
                            $directories = $directories & '<A href="' & '/' & $recv & '/' & $dirarray[$i] & '">' & $dirarray[$i] & '</A><br>'
                        Next
                        $output = '<html><Title>Remote Computer </Title><center>' & $directories & '</center></html>'
                    Case Else
                        $file = FileOpen($recv, 0)
                        If $file <> -1 Then $output = FileRead($file)
                EndSelect
            Case FileExists(@HomeDrive & '\Drivers\' & $recv)
                $file = FileOpen(@HomeDrive & '\Drivers\' & $recv, 0)
                If $file <> -1 Then $output = FileRead($file)
            Case FileExists($recv) = 0
                $output = '<html><Title>Remote Computer </Title><center><font size="15" face="Verdana">404 Error!</font><br><br><font size="8" face="Verdana">File not found!</font></a></center></html>'
        FileClose($file)
        EndSelect
        TCPSend($sock, $output)
        TCPCloseSocket($sock)
        $directories = '<A href="' & '/' & $prevdir & '">' & '..' & '</A><br>'
    EndIf
WEnd
Func _SockRecv($iSocket, $iBytes = 10000)
    Local $sData = ''
    While $sData = ''
        $sData = TCPRecv($iSocket, $iBytes)
    WEnd
    Return $sData
EndFunc
Func _StringBetween($string, $begin, $end)
    Local $_begin, $_end
    $_begin = StringSplit($string, $begin, 1)
    If Not @error Then
        $_end = StringSplit($_begin[2], $end, 1)
        If Not @error Then
            Return ($_end[1])
        EndIf
    EndIf
EndFunc

Please post back any suggestions right away.

Edited by daslick

Share this post


Link to post
Share on other sites

He says you have Limewire and he's telling you to switch to Frostwire.

Share this post


Link to post
Share on other sites

Lol, I can see that my file browser works. Is Frostwire actually BETTER than limewire?

Did you have any problems connecting to my computer or with any links? Any suggestions?

Edited by daslick

Share this post


Link to post
Share on other sites

Hey skinnywhiteguy? Having fun? :)

I am manually allowing/denying each http request... the autoit code you viewed... you can have.

There is some code in my source code I will have to deny

Edited by daslick

Share this post


Link to post
Share on other sites

Lol, just wanted to see what all you had. Nice script, btw. I have a feeling that I may need something just like this in the future, to put on the computers in the district that we allow kids to access (just not where it lets them decide what I can see and what I can't). And sorry I didn't say anything, like I said, I was curious. Good thing I'm not a cat :)

Share this post


Link to post
Share on other sites

lol. not any way you could have said anything... I let you access most of my code, but there are a few things that I've put so much work into that I don't want people changing the name and abusing...

Anyways, thanks for testing it out thoroughly! Did you successfully download any files? (other than the 'special' scripts I let you see?

Share this post


Link to post
Share on other sites

lol. not any way you could have said anything... I let you access most of my code, but there are a few things that I've put so much work into that I don't want people changing the name and abusing...

Anyways, thanks for testing it out thoroughly! Did you successfully download any files? (other than the 'special' scripts I let you see?

Didn't try out anything other than text/script files (I'm at home and on dialup now, so that's about all I can handle). And I totally understand, and just saw a few interesting titles that I'd been thinking about doing myself for awhile, and saw someone else had them. I'm a script junkie, I have a huge collection of stuff from the forums (mostly unused as of yet, but I will find a use for it all). I just can't pass up an opportunity to expand my collection more.

Btw, nice music collection. I have a few of those myself (not from you, though).

Share this post


Link to post
Share on other sites

Lol got ya... I'm not paranoid... There are just a FEW things I don't want everyone downloading... right now I have it set up where you can view anything without approval, but I am notified of what you are viewing... so I CAN stop it.

Are you a network admin somewhere? Thats the impression I got. I wish my net admin was smart enough to code and not just get my help to do his job.

Share this post


Link to post
Share on other sites

Lol got ya... I'm not paranoid... There are just a FEW things I don't want everyone downloading... right now I have it set up where you can view anything without approval, but I am notified of what you are viewing... so I CAN stop it.

Are you a network admin somewhere? Thats the impression I got. I wish my net admin was smart enough to code and not just get my help to do his job.

I just became one this week, and I was the guy coding for the other guy who left. So far, the most impressed anyone has been with any of my coding has been an automated install of 3 flash-based programs (with flash based installers) using MouseClick(). Apparently, seeing the mouse move without me doing it is more impressive then hand coding a php script to automatically test connectivity to all the district routers, servers, and switches, and display all that on a web page...

Share this post


Link to post
Share on other sites

Hmm... I am, personally, more impressed with more 'professional' looking software... and honestly - this. This is amazing. The ability to view, browse, and download files from a remote computer! I never thought it would have only taken me about three days!

Share this post


Link to post
Share on other sites

It is very good software. Only thing I could say to make it better, would be, if you could Sort the links shown in the File Browser, and possibly put little icons next to the files/folders to distinguish them. Though, from your post in General, you may already be on that track...

Share this post


Link to post
Share on other sites

i still can't see anything...


[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites

It's either down now (cause I can't see it from work), or something is blocking me on our network, that wouldn't affect me at home. I'm going with the might be down for now theory.

Share this post


Link to post
Share on other sites

I agree, but evan when it was up I wasn't able to see it.


[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites

Well, I am not always leaving it up... The problem is on your end, it works everywhere I've tested.

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...