I just don't get it. Please see my code below...
def startscan(rangeip,ports,cblocks):
pool = ThreadPool(processes=MAX_THREADS)
results = []
testt = []
#print(rangeip)
#print(ports)
#print(cblocks)
for ii in range(cblocks):
print(rangeip[2])
rangeip[2] = int(rangeip[2]) + 1
print(rangeip[2])
print(rangeip)
testt.append(rangeip)
print(testt)
When I run it it returns this output :
root@node2nl home]# python g.py -r 192.168.20.1 -p 80 -a 3
20
21
['192', '168', 21, '1']
21
22
['192', '168', 22, '1']
22
23
['192', '168', 23, '1']
[['192', '168', 23, '1'], ['192', '168', 23, '1'], ['192', '168', 23, '1']]
As you can see all is correct except the list testt does not gett filled right. It shows three times the same value. I need it to output the right result like below
[['192', '168', 21, '1'], ['192', '168', 22, '1'], ['192', '168', 23, '1']]
What am I doing wrong ? It seems like something very weird is going on here.