Port sweep with python
<p>Well im trying to do something really simpale but from some reason i just can't understand how to do it.</p>

<p>Im trying to write a simple port sweep
let's say i have a gateway address of 192.168.1.1 all i want to do is to create a for loop to run between 1 to 254 and test what ip address there are over the network </p>

<p>The for loop is really easy:</p>

<pre><code>for i in range(1,254,1):
</code></pre>

<p>I need that i will change everytime at 192.168.1.i</p>

<p>How can i do that?</p>

<p>Use string formatting to accomplish that</p>

<pre><code>'192.168.1.{0}'.format(i)
</code></pre>

<p>Or be a brute and do concatenation</p>

<pre><code>'192.168.1.' + str(i)
</code></pre>

python for-loop networking ping