Skip to main content
edit
Fonte Link
brow-joe
  • 2,2mil
  • 8
  • 15

Faltou inserir a quebra de linha "\n", vc pode utilizar .write("\n") por exemplo:

from scapy.all import *
    
    
    pkts = rdpcap("lalalao.pcap")
    
    for p in pkts:
    ##  print p.time
    
    
            if IP in p: #if packet has IP layer
                        src_ip = p[IP].src
                        dest_ip = p[IP].dst
                        print src_ip
    
                        f = open('IP_src.txt', 'w')
                        for ip in src_ip:
                                f.writelineswrite(ip)
                       + f.write("\n")
    
                        f.close()

Faltou inserir a quebra de linha "\n", vc pode utilizar .write("\n") por exemplo:

from scapy.all import *
    
    
    pkts = rdpcap("lalalao.pcap")
    
    for p in pkts:
    ##  print p.time
    
    
            if IP in p: #if packet has IP layer
                        src_ip = p[IP].src
                        dest_ip = p[IP].dst
                        print src_ip
    
                        f = open('IP_src.txt', 'w')
                        for ip in src_ip:
                                f.writelines(ip)
                        f.write("\n")
    
                        f.close()

Faltou inserir a quebra de linha "\n", vc pode utilizar .write("\n") por exemplo:

from scapy.all import *
    
    
pkts = rdpcap("lalalao.pcap")
    
for p in pkts:
    ##  print p.time
    
    
    if IP in p: #if packet has IP layer
        src_ip = p[IP].src
        dest_ip = p[IP].dst
        print src_ip
    
        f = open('IP_src.txt', 'w')
        for ip in src_ip:
            f.write(ip + "\n")
    
        f.close()
edit
Fonte Link
brow-joe
  • 2,2mil
  • 8
  • 15

Faltou inserir a quebra de linha "\n", vc pode utilizar .write("\n") por exemplo:

from scapy.all import *

 
pkts = rdpcap("lalalao.pcap")

for p in pkts:
##  print p.time


        if IP in p: #if packet has IP layer
                    src_ip = p[IP].src
                    dest_ip = p[IP].dst
                    print src_ip

                    f = open('IP_src.txt', 'a+')
                    for ip in src_ip:
                            f.writelines(ip)
                            f.write("\n")

                    f.close()

ou

from scapy.all import *
    
    
    pkts = rdpcap("lalalao.pcap")
    
    for p in pkts:
    ##  print p.time
    
    
            if IP in p: #if packet has IP layer
                        src_ip = p[IP].src
                        dest_ip = p[IP].dst
                        print src_ip
    
                        f = open('IP_src.txt', 'a+''w')
                        for ip in src_ip:
                                f.writelines(ip)
                        f.write("\n")
    
                        f.close()

Faltou inserir a quebra de linha "\n", vc pode utilizar .write("\n") por exemplo:

from scapy.all import *

 
pkts = rdpcap("lalalao.pcap")

for p in pkts:
##  print p.time


        if IP in p: #if packet has IP layer
                    src_ip = p[IP].src
                    dest_ip = p[IP].dst
                    print src_ip

                    f = open('IP_src.txt', 'a+')
                    for ip in src_ip:
                            f.writelines(ip)
                            f.write("\n")

                    f.close()

ou

from scapy.all import *
    
    
    pkts = rdpcap("lalalao.pcap")
    
    for p in pkts:
    ##  print p.time
    
    
            if IP in p: #if packet has IP layer
                        src_ip = p[IP].src
                        dest_ip = p[IP].dst
                        print src_ip
    
                        f = open('IP_src.txt', 'a+')
                        for ip in src_ip:
                                f.writelines(ip)
                        f.write("\n")
    
                        f.close()

Faltou inserir a quebra de linha "\n", vc pode utilizar .write("\n") por exemplo:

from scapy.all import *
    
    
    pkts = rdpcap("lalalao.pcap")
    
    for p in pkts:
    ##  print p.time
    
    
            if IP in p: #if packet has IP layer
                        src_ip = p[IP].src
                        dest_ip = p[IP].dst
                        print src_ip
    
                        f = open('IP_src.txt', 'w')
                        for ip in src_ip:
                                f.writelines(ip)
                        f.write("\n")
    
                        f.close()
for
Fonte Link
brow-joe
  • 2,2mil
  • 8
  • 15

Faltou inserir a quebra de linha "\n", vc pode utilizar .write("\n") por exemplo:

from scapy.all import *


pkts = rdpcap("lalalao.pcap")

for p in pkts:
##  print p.time


        if IP in p: #if packet has IP layer
                    src_ip = p[IP].src
                    dest_ip = p[IP].dst
                    print src_ip

                    f = open('IP_src.txt', 'a+')
                    for ip in src_ip:
                            f.writelines(ip)
                            f.write("\n")

                    f.close()

ou

from scapy.all import *
    
    
    pkts = rdpcap("lalalao.pcap")
    
    for p in pkts:
    ##  print p.time
    
    
            if IP in p: #if packet has IP layer
                        src_ip = p[IP].src
                        dest_ip = p[IP].dst
                        print src_ip
    
                        f = open('IP_src.txt', 'a+')
                        for ip in src_ip:
                                f.writelines(ip)
                        f.write("\n")
    
                        f.close()

Faltou inserir a quebra de linha "\n", vc pode utilizar .write("\n") por exemplo:

from scapy.all import *


pkts = rdpcap("lalalao.pcap")

for p in pkts:
##  print p.time


        if IP in p: #if packet has IP layer
                    src_ip = p[IP].src
                    dest_ip = p[IP].dst
                    print src_ip

                    f = open('IP_src.txt', 'a+')
                    for ip in src_ip:
                            f.writelines(ip)
                            f.write("\n")

                    f.close()

Faltou inserir a quebra de linha "\n", vc pode utilizar .write("\n") por exemplo:

from scapy.all import *


pkts = rdpcap("lalalao.pcap")

for p in pkts:
##  print p.time


        if IP in p: #if packet has IP layer
                    src_ip = p[IP].src
                    dest_ip = p[IP].dst
                    print src_ip

                    f = open('IP_src.txt', 'a+')
                    for ip in src_ip:
                            f.writelines(ip)
                            f.write("\n")

                    f.close()

ou

from scapy.all import *
    
    
    pkts = rdpcap("lalalao.pcap")
    
    for p in pkts:
    ##  print p.time
    
    
            if IP in p: #if packet has IP layer
                        src_ip = p[IP].src
                        dest_ip = p[IP].dst
                        print src_ip
    
                        f = open('IP_src.txt', 'a+')
                        for ip in src_ip:
                                f.writelines(ip)
                        f.write("\n")
    
                        f.close()
writelines
Fonte Link
brow-joe
  • 2,2mil
  • 8
  • 15
Carregando
Fonte Link
brow-joe
  • 2,2mil
  • 8
  • 15
Carregando