The Reverse Port Scan

Have you ever wanted to know which outbound ports are open in your school’s/workplace’s firewall? I know I have. And it always frustrated me that finding out seems like an impossible task. And it isn’t really that odd, either, as you would need a host listening on every single port from 1 to 65535 that you could attempt to connect to in order to find out if the firewall would let you through. Well, I’ve come up with a solution.

In an attempt to find out which outbound ports are open in my university’s firewall, I developed a small test suite consisting of 2 PHP scripts – a client and a server. The server script must be run on a host that has pretty much unrestricted access to the Internet. If you’re running it at home, on a host behind a NAT router, I recommend configuring it as the “DMZ host” on the router, as that basically forwards all ports to it.

The suite then works by having the client send a request to the server to open a specific port range to be tested. The client then attempts to connect to these, and when done, it requests the next range, until every port is tested. The server may discover that it is unable to open certain ports due to other services running on the host, and the client will be notified. These will show up as “Untested ports” in the test results.

Please take a look at each file in your favorite text editor – there are a few settings you probably need to adjust, including the server host name, last port to test and such.

Download here

Note: You will need the PHP interpreter to run the scripts. You can get a Windows build here. Also, you must enable the Sockets and cURL extensions for it to work.

Tip: If you have a dynamic IP address on your Internet connection, you can use services such as No-IP to get a dynamic DNS domain that always points home.

Warning: I made no attempts to implement any sort of security into this test suite, so you shouldn’t leave it running for any longer than absolutely necessary, nor can I recommend permanently having your computer as “DMZ host”.

Update: To test single ports without having to set up your own server, you can use http://portquiz.positon.org/

Introduction

Hi!

I haven’t made any real posts yet, so I thought I might as well tell a bit about myself. I am currently 21 (but will turn 22 on March 4), and I recently enrolled in the Aarhus School of Engineering to study electrical engineering. I hope to one day work with signal processing, possibly in the professional audio equipment industry.

As you might have guessed, I have a passion for electonics and programming. It most likely stems from my childhood of playing video games. Computers have always intrigued me, and I’ve always been interested in what makes them tick. My first programming experience was BASIC on the Commodore 64. Since then, I got into web development and my primary programming language at the moment is probably PHP. My interest in web development led to the creation of SMW Central, a Super Mario World hacking resource which has grown quite a lot since its inception. Smallhacker also played a big part in its success.

I used to have a small electronics kit with a few lamps and LEDs that you could make light up, and as interesting as that was when I was little, it quickly died out due to the fact that you need a good amount of knowledge to be able to build anything meaningful. I was reminded of how much fun I had with electronics during my last year of high school, where I took a course about it. You can see some of the projects and tests I worked with on my YouTube channel.

I’m not really working on anything interesting at the moment, but I will definitely write about it here once I am. Until then!

Minecraft Memory

Okay, this place needs some real content, so… here’s two kinds of memory I built in Minecraft.

Piston-based memory

This is a byte of readable memory with the ability to increase its value by one on request. Each byte is stored as a stack of gold/glass, the position of which determines its current value. A toggle signal (coming from the right) checks if it’s set or clear and triggers one of the pistons depending on the state, toggling it. If it’s switched from 1 to 0, the trigger signal is sent on to the next bit in line, and so on.

All 8 bits. The yellow line of wool in the distance sends a clock pulse to make the byte continuously increase by one.

For good measure, a piston-powered display unit which – due to my poor planning – has the LSB to the left and the MSB to the right. Oops. The switch to the left switches between normal and overclocked which doubles the clock pulse frequency. All in all, the system completely lacks redstone torches (except as a source of constant power) as they burn out when used in this high-frequency system.

Repeater-based memory

Now here’s a major kludge, basically thrown together as a proof-of-concept. It stores bytes as a loop of 8 repeaters, making the individual bits fly around in a circle. The entire system is thus based on timing. The large triangle at the bottom is used to generate an 8-tick pulse (which I’m technically misusing here out of laziness as its input is more than one tick long) used for operations that affect all 8 bits of the two registers.

The loop in the lower right defines the constant value 1 and thus, in theory, the timing of the system. The loop to the left of it is the A register. The gold block makes sure that the data is retained. Triggering the piston for 8 ticks will break the circuit and clear the byte. At the top of the loop, where the other gold block doesn’t complete a circuit, is the input for the constant 1, allowing one to OR the register with 1 if the piston is activated for 8 ticks. (Hardly useful, I know, but proof-of-concept, remember?)

A shot of the essentially identical B register. Also visible to the right of it is two lines of repeaters in opposite directions. By completing those circuits for 8 ticks, one can transmit the data from one register into the other, ORing them. By first clearing the target register, it simply works as a normal copy.

There’s currently no way of outputting the values, mostly because I haven’t had time to make such a system yet.

Pistons are used for changing the state of the system as redstone torches again are too slow to handle the high update frequency.

Encounter at Farpoint

Cue a 10 minute scene of flying around the website and watching it from various angles with reaction shots of me spliced in.

So, this is Tubecloggers. It’s… uglier than I expected. Now, the time travelers from the future who look through the archive will have no idea what I’m talking about as the site will most likely be beautiful in the prosperous future I’m sure they’re from. Rest assured that when this post was written, this site was… ugh.

What was I talking about?

Oh yeah. Uh. I’m Smallhacker. It’s my job to clog your tubes with random nonsense and rants in the hope of reaching internet celebrity. Yep. I’m going to become the next… uh… (insert person who got famous through blogging). Wait, do such people even exist? Uh. I dunno? Let’s pretend that there is one… and let’s call him Bob. Yep. I’m going to be the next Bob. Yeah. Can’t wait.

This is going to be awesome.

First!

So yeah, I’ve had this domain for quite a while now. Smallhacker and I wanted to set up a bloggish site together a long time ago, but it never really got anywhere. Now, we decided to give it another go using WordPress. We still have a lot of stuff to set up, though, like a proper theme.

In case you might be wondering what kind of content you’ll see here, I can tell you that we don’t really know, either. Most likely, we will post about computers, technology, programming, rants, personal endeavors and other random (un)creative things.

See you around.