Stoppt die Vorratsdatenspeicherung! Jetzt klicken &handeln! Willst du auch an der Aktion teilnehmen? Hier findest du alle relevanten Infos
  und Materialien:

Skip to content


Blocktalk: A simple portscanner

Here’s a little blocktalk script, that shows the latest working feature I’ve added to my Blocktalk interpreter: Exception handling :)

Basically, it’s just a simple portscanner.

?Download portscan.bt
System require: "socket"
 
host = "localhost"
 
(ARGV at: 0) if {
  host = (ARGV at: 0)
}
 
open_ports = []
 
1 upto: 1024 do |port|
  Thread new {
    try{
      t = TCPSocket new: host port: port
      open_ports << port
 
      s = Socket getnameinfo: ["AF_INET", port, host]
      Console puts: ("\nPort #{port} (#{s[1]})" + " is open.")
 
      catch{
        Console print: "."
      }
 
      ensure{
        t if { t close }
      }
    }
  }
end
 
Console puts
Console puts: "Open ports on #{host} are:"
Console puts: (open_ports join: ", ")

So yeah, this is actually working. Now I’ve basically have most of the language features done that I had in mind first. Next to come are probably some performance optimizations as well as some more unique features, I still have to come up with. We’ll see :)

Update:
I’ve added Threading to the code, this speeds up the process a little ;)

Posted in General. Tagged with , , , , , , , , .

2 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Not bad, not bad…but I can´t try it out right now, got to get the bus ;)

  2. you would also need the interpreter to actually try it out ;)
    i’ll put the code on github soon, need to clean it up a little first and add some documentation ;)

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.


Ihr Browser versucht gerade eine Seite aus dem sogenannten Internet auszudrucken. Das Internet ist ein weltweites Netzwerk von Computern, das den Menschen ganz neue Möglichkeiten der Kommunikation bietet.

Da Politiker im Regelfall von neuen Dingen nichts verstehen, halten wir es für notwendig, sie davor zu schützen. Dies ist im beidseitigen Interesse, da unnötige Angstzustände bei Ihnen verhindert werden, ebenso wie es uns vor profilierungs- und machtsüchtigen Politikern schützt.

Sollten Sie der Meinung sein, dass Sie diese Internetseite dennoch sehen sollten, so können Sie jederzeit durch normalen Gebrauch eines Internetbrowsers darauf zugreifen. Dazu sind aber minimale Computerkenntnisse erforderlich. Sollten Sie diese nicht haben, vergessen Sie einfach dieses Internet und lassen uns in Ruhe.

Die Umgehung dieser Ausdrucksperre ist nach §95a UrhG verboten.

Mehr Informationen unter www.politiker-stopp.de.