r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Gabriele
5-Jun-2005
[1186]
can you check port/locals/list? what do you get there?
Guest
5-Jun-2005
[1187]
hi gabriele, thx for reply. if I open the port, the loop instant 
apears. the only way to stop is to press escape... after this the 
port has no value.
Micha
5-Jun-2005
[1188x8]
rebol [ title: "SOCKS SERWER" ]

conn: make port! tcp://:800

proxy: make object! [ host: 208.59.117.69
                      port: 2988  ]



black-lista: [ 69.64.51.223 194.69.207.145 80.252.0.145 194.69.207.165 
217.73.17.115]




adns: open/no-wait make port! dns:///async

adns/awake: func [port /local data][                
		
		data: copy port

                print data
		
		false 
	]				

insert tail system/ports/wait-list adns





heandler: func [ port /local data dns  serwer client]

               [ serwer: first port

                          
 wait serwer
             
data: copy serwer
;data: make string! 10000
;read-io serwer data 10000
print ["data1" to-binary data]

dns: to-tuple copy/part skip to-binary  data 4 4  

insert adns dns ;print dns name



either find black-lista dns [ close serwer  print "firtled" print 
read join dns:// dns ]
                           
                            [ print "new connetion"

insert serwer  join #{005A} [debase/base  skip to-hex serwer/port-id 
4 16 to-binary dns ] 


client: make port! [ scheme: 'tcp 
                     host: system/words/proxy/host
                     port-id: system/words/proxy/port
]



;insert tail system/ports/timeout-list client

      open/no-wait/binary/async/direct client :response


client/sub-port: serwer





insert tail system/ports/wait-list  client

client/date: data

serwer/sub-port: client

serwer/awake: :request









] 



       false         
]




request: func [ port /local data  f ] 

              [ data: make string! 10000
               read-io port data 10000


if f: find data "GET /favicon.ico" [ insert port "HTTP/1.1 404 Not 
Found" 
                                      print "favicon.ico"]
 


                either (data <> {}) and not f [     print [ "data3" data  ]
                              

                                if error? try [    write-io port/sub-port data length? data ][ print 
                                "error: close serwer"]
                                   ; insert port/sub-port data 
]

                            [  close port 

                              remove find system/ports/wait-list port port
                               close port/sub-port

                              remove find system/ports/wait-list port/sub-port port/sub-port
                              print "close connetion client"

                               print length? system/ports/wait-list
                               ]

               false]




       
   


  
response: func [ port e a /local data  f  ] 

               [  switch e [ open [ insert port port/date ]
                                    
                             read [ data: copy/part port a

                                   either ( a <> 8 ) [write-io port/sub-port data length? data] 

                                                     [  insert tail system/ports/wait-list  port/sub-port ]
                                    ]
                                     
                             close [ close port 

                                     remove find system/ports/wait-list port port
                                     close port/sub-port

                                     remove find system/ports/wait-list port/sub-port port/sub-port

                                       print "close connetion serwer"

                                      print length? system/ports/wait-list]
 

                          ]   ]


start: func [] [

conn: make port! tcp://:800

conn/awake: :heandler

set-modes conn [no-wait: false]

insert tail system/ports/wait-list  conn

open/no-wait/direct/binary conn ]


stop: func [][ close conn
               remove find system/ports/wait-list conn]

set-proxy: func [ h p ] [ proxy/host: h
                          proxy/port: p ]
                          


print "proxy"

lay:  layout [ backdrop blue
              across  h3  red "PROXY" f: field 145 
              return
              button green "start" [ p: parse f/text  ":"
                                     remove find p "" 

                                     set-proxy  to-tuple p/1  to-integer p/2
                                     source p
                                    
                                     start]
              button  green "stop" [f/text: "" stop ] ]

view/offset lay 4x29 
halt
I ask about help .
to improve someone  this programme maybe ?
in order to he was better .
jak napisaæ serwer  tunel : client - socks - http proxy - serwer 
?
how to write server  tunnel : client - socks - http proxy - server 
?
1. firefox  connet socks serwer .
2. socks serwer connett proxy serwer .
3. proxy serwer connet internet
to pass someone code of such application maybe ?
Gabriele
6-Jun-2005
[1196x2]
Guest: you can try: port: make port! http://yoururlopen port  
 (after pressing esc you can access port/locals/list)
otherwise, just try with trace/net on. you'll get a lot of output 
but surely the answer will be there somehow.
Ammon
6-Jun-2005
[1198]
Does anyone else find the fact that encloak/decloak CHANGES the 'data 
value passed to them confusing?  It sure has caused me quite a bit 
of headache!
Vincent
6-Jun-2005
[1199]
encloak/decloak : I think it's a good thing for security. You don't 
want having both encrypted and unencrypted data in memory. Modifying 
the data assure that the unencrypted string isn't available anymore 
(if you don't explicitly copy it.)
Ammon
6-Jun-2005
[1200]
Ah, I see.  That makes sense.
Sunanda
6-Jun-2005
[1201]
And it works the same way as replace or uppercase -- directly on 
the data.
Guest
6-Jun-2005
[1202]
rebol newby needs pop script to delete 1000 bounces from mailer daemon 
(was spam attacked) need to be able to delete emails based on subject 
or from to pattern. Thanks for any pointers or direction to sample 
script
Graham
6-Jun-2005
[1203x3]
the problem with the standard rebol pop protocol is that it doesn't 
allow you to download the headers only.
DideC has a script somewhere that allows you to examine your mail 
box and delete selected email.
I do too, but mine is part of a larger anti-spam package.
http://membres.lycos.fr/didec/rebsite/delete-emails/delete-emails3.0.0.html
Guest
7-Jun-2005
[1206]
thanks Graham. this looks pretty neat . i may be able to use some 
of this code. i just need a simple script that connects to pop, loops 
through emails and checks each one for pattern in subject and deletes 
it if it matches. thanks again.
Graham
7-Jun-2005
[1207x2]
your're welcome guest
In most cases, where some spam has been bounced back to you as the 
account does not exist, the first line of the email says something 
like

Return-Path: <>

The <> is a special null email address to stop mail loops.


So, if you check all your email for this first line, then you should 
be able to delete all the automated bounces.
yeksoon
10-Jun-2005
[1209]
what is the correct way to handle vector arithmeitc? Or rather, is 
there an easy way to show vector arithmetic

eg.
2 * [2, 3, 4] .... results should be [6, 8, 10]
MikeL
10-Jun-2005
[1210]
You could use Andrew Martin's map function to achieve this

do http://www.rebol.org/library/scripts-download/arguments.r; 
Needs

do http://www.rebol.org/library/scripts-download/map.r; Instantiate
map func [a][2 * a] [1 2 3 4 5 6] ; supply the function to map
>>[2 4 6 8 10 12]
Gregg
10-Jun-2005
[1211]
You might also check out Ladislav's matrix functions: http://www.fm.vslib.cz/~ladislav/rebol/#section-6
MichaelAppelmans
11-Jun-2005
[1212x4]
trying to open a pop mailbox with nonstandard password with the following 
code:
REBOL []
 mailbox: open [
        scheme: 'pop
        user: "myname"
        pass: "%$100k"
        host: "mydomain.com"
    ]

foreach message mailbox [
    print message
    ask "Next? "
]
close mail
I get the following error when I do this: ** Script Error: foreach 
expected data argument of type: series
** Near: foreach message mailbox [
    print message
    ask "Next? "
]
close
this is from a simple example in the script library with the only 
modification being an open block instead of a single line open. Thanks 
for any insight.
Graham
11-Jun-2005
[1216x2]
that would happen if mailbox = none
try 

print type? mailbox before you use the foreach
MichaelAppelmans
11-Jun-2005
[1218]
thanks Graham, I get " type has no value" does this mean that rebol 
is unable to open this pop account? I know my domain, user and pwd 
are correct
Graham
11-Jun-2005
[1219x2]
don't you need to specify the port id/
try setting 

trace/net on

before you open the port and see what happens
BrianH
11-Jun-2005
[1221]
No, it means that you used type instead of type? (with the question 
mark)
MichaelAppelmans
11-Jun-2005
[1222]
right  you are Brian, I had type ? not type? which returns port. 
so it is opening the mailbox but isn't mailbox a series?
Graham
11-Jun-2005
[1223]
I think some of the documentation on pop is incorrect as you have 
found.
MichaelAppelmans
11-Jun-2005
[1224]
aha. I think my understanding of using pop is flawed. i need some 
zzzzz's for now will play with this on the morrow. thanks for the 
help. gnight
Graham
11-Jun-2005
[1225]
user:[pass-:-mail-:-example-:-com]
remove at mailbox 22
close mailbox

this example I'm pretty sure doesn't work
MichaelAppelmans
11-Jun-2005
[1226]
complication is i have a password with special chars % and $ so i 
have to use the block form of the url
Graham
11-Jun-2005
[1227]
that's not the problem
MichaelAppelmans
11-Jun-2005
[1228x2]
i think i figured out what the problem was, I had a pop block, with 
open mailbox: open [scheme: 'pop ...etc
i tried mailbox: read [scheme: 'pop and it's running but I expect 
to run out of heap space as I have 800 emails  ;)
Graham
11-Jun-2005
[1230x2]
; open mailbox

len: length? mailbox
bounces: copy []

for i 1 len 1 [
	email: import-email raw: pick mailbox i
	if email/reply-to = "<>" [
		append bounces i
		print [ "Bounce at" i ]
	]
]

; remove bounces

reverse bounces
foreach num bounces [
	mailbox: head mailbox
	mailbox: skip mailbox ( num - 1 )
	remove mailbox
]

close mailbox
untested ... :)
MichaelAppelmans
11-Jun-2005
[1232]
wow, I'm impressed, I might have to stay awake for this ;)!!
Gregg
11-Jun-2005
[1233]
Graham is the mail master, along with Phil. :-)
Graham
11-Jun-2005
[1234]
Hey, it's untested .... !!
MichaelAppelmans
11-Jun-2005
[1235]
this is a great example. at this time I'm going to be moving bounces 
into another mailbox instead of deleting them as I need them for 
forensic evidence. We have just received word that the ISP is forcing 
the subscriber offline as the spam constitues a breach of contract