Measuring the Transmit Traffic for Scraping Traffic

Asked 1 years ago, Updated 1 years ago, 352 views

For example, suppose you run the following file as a sample:
What exactly should I do to measure incoming and outgoing traffic?
(Source https://techacademy.jp/magazine/20930)

 (python)
import requests
from bs4 import BeautifulSoup
result=requests.get('https://newspicks.com/') 
data_1 = BeautifulSoup(result.text, 'html.parser')
data_2=data_1.find_all("div", class_="title_ellipsis")
for item in data_2:
  print(item.getText())

python wireshark tcpdump tshark

2022-09-30 21:49

1 Answers

How exactly can I measure incoming and outgoing traffic?

Using the tshark command, I actually showed the traffic, not just a complete copy.Your environment is CentOS Linux release 8.1.1911(Core).

The procedure is as follows:

Launch the tcpdump command to start capturing packets.The result file should be test.cap.
Run the code of the person who asked the question (at another terminal).
Exit tcpdump at ^C.

#tcpdump-iens 160 not tcp port22-wtest.cap
tcpdump —listening onens 160, link-type EN10MB (Ethernet), capture size 262144 bytes
^C300 packets captured
331 packets received by filter
0 packets dropped by kernel

Then issue the tcpdump command with the result file for tcpdump'.
The following example displays Statistics for All Protocols.

#tshark-qr test.cap-zio,phs
Running as user "root" and group "root". This could be dangerous.

===================================================================
Protocol Hierarchy Statistics
Filter:

eth frames: 300 bytes:43106
  arp frames:225 bytes:13500
  ip frames:63 bytes:28838
    udp frames:30 bytes:4870
      data frames:3 bytes:1743
      nbns frames:18 bytes:1656
      nbdgm frames:5 bytes:1215
        smb frames:5 bytes:1215
          mailslot frames:5 bytes:1215
            browser frames:5 bytes:1215
      llmnr frames:4 bytes:256
    tcp frames:33 bytes:23968
      http frames:10 bytes:7918
        tcp.segments frames:1 bytes:68
        ssl frames:8 bytes:7745
          tcp.segments frames:2 bytes:3379
            http frames:2 bytes:3379
              ssl frames:2 bytes:3379
  frames:12 bytes:768
===================================================================


2022-09-30 21:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.