Jump to content
Sign in to follow this  
NepesX

How to get traffic information

Recommended Posts

NepesX

I need to get information on the number of bytes sent and received, please help!

Share this post


Link to post
Share on other sites
water

Welcome to AutoIt and the forum!

There are a lot fo examples available on the forum which give you the needed performance counters. One of them is

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Decipher

Are you sending the data yourself?

Why do you need to do so?

What have you tried so far?

http://www.nirsoft.net/utils/network_traffic_view.html - NirSoft - Always a good choice plus all the utillites have command line switches with output formats such as XML.

http://www.codeproject.com/Articles/5331/Retrieve-the-number-of-bytes-sent-received-and-oth - Requires creating a free account to download but the executable is 17kb in size and can be used in conjunction with FileInstall.

http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/26b20572-bd95-492e-af6b-3d573c4ec2a1/ - VBScript - This could be implemented in AutoIt plus it would make a cool UDF.

This information should also be obtainable from the TaskManager - taskmgr.exe

*Edit - I see that the cool UDF has already been created. LOL

Edited by Decipher
  • Like 1

Spoiler

censored.jpg

 

Share this post


Link to post
Share on other sites
NepesX

I want the program to make autoit, which shows the internet traffic, if there is I have to UDF, there is such a UDF?

Share this post


Link to post
Share on other sites
water

The link I posted is no UDF but will allow you to grab the functions you need for your script.

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
NepesX

Water, Thank you very much

Share this post


Link to post
Share on other sites
water

Glad to be of service :D

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
careca

Check this you'll need includes:

_PDH_PerformanceCounters.au3 + _WinAPI_GetSystemInfo.au3

Edited by careca
  • Like 1

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
water

That's exactly what I posted in #2 ;)

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
careca

Yes but you posted the entire suite, i only posted the network bit. :P

  • Like 1

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
water

Oh, I see, your link refers to a single post in the thread, mine to the whole thread.

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
GodlessSinner

;getting info about traffic----------
Func get_info()
    $cmd = Run(@comspec & " /c netstat -e", @SystemDir, @SW_HIDE,  $STDIN_CHILD & $STDOUT_CHILD)
    Sleep(500)
    $line = StdoutRead($cmd)
    $st = StringSplit($line,@CR)
    For $i = 1 to $st[0]-1 Step 2
        If $st[$i] <> "" And $i = 5 Then
            $strn = StringSplit($st[$i],"")
            $string = $st[$i]
            For $n = 1 to $strn[0] Step 1
                If StringIsDigit($strn[$n]) And $trimmed = 0 Then
                    $alltrimmed = 1
                    $stout = $stout & $strn[$n]
                ElseIf Not StringIsDigit($strn[$n]) And $alltrimmed = 1 Then
                    $trimmed = 1
                EndIf
            Next
            If $current = -1 And $afftermin = -1 Then
                $current = $stout
            ElseIf $current <> -1 And $afftermin = -1 Then
                $afftermin = $stout
            EndIf
                $stout = ""
                $trimmed = 0
                $alltrimmed = 0
        EndIf
    Next
    EndFunc

  • Like 1

_____________________________________________________________________________

Share this post


Link to post
Share on other sites
careca

GodlessSinner:

Hi, that code doesn't work as-is, would be nice if you could post the whole code, includes, autoit tags and all ;)


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
Chimp

maybe this link can be useful.

it uses the "netstat -e" dos command to measure the upload/download traffic

with few modifications I reduced it to a simple general purpose network traffic meter.

to see it in action, first execute the script and then navigate the web to generate network traffic

bye

; http://www.autoitscript.com/forum/topic/59324-analyze-network-traffic/
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <Constants.au3>
#include <array.au3>
#include <string.au3>

Opt("GUIOnEventMode", 1)

$begin1 = TimerInit(); Startpunkt Zeitmessung für Netstat
;; $start = TimerInit(); Startpunkt Zeitmessung für Tracking

$NetGUI = GUICreate("Tracking Guard v1.0", 294, 100, 197, 120, -1, BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

$Up = GUICtrlCreateLabel("SpeedUp", 8, 50, 100, 20, BitOR($SS_CENTER,$SS_SUNKEN,$WS_GROUP))
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

$Down = GUICtrlCreateLabel("SpeedDown", 176, 50, 100, 20, BitOR($SS_CENTER,$SS_SUNKEN,$WS_GROUP))
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

GUICtrlCreateLabel("Upload", 31, 20, 55, 20, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

GUICtrlCreateLabel("Download", 190, 20, 70, 20, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

$Progress1 = GUICtrlCreateProgress(8, 80, 100, 9)
$Progress2 = GUICtrlCreateProgress(176, 80, 100, 9)

GUISetState(@SW_SHOW)
GUISetOnEvent(-3, "_exit")

;Initialisieren
$UpStr = 0
$DownStr = 0
$time = 0
$UpStr_alt = 0
$DownStr_alt = 0


_netstat($UpStr, $DownStr); Up,Down das erste mal lesen um Verschiebungspunkte zu suchen
$Xup = $UpStr;Startpunkt setz en
$Xdown = $DownStr


While 1

Sleep (500)

_netstat($UpStr, $DownStr)

;Differenzen berechnen
$UpStr = $UpStr - $Xup
$DownStr = $DownStr - $Xdown

$Up_speed = $UpStr - $UpStr_alt
$Down_speed = $DownStr - $DownStr_alt


;Zeitliche Differenz berechnen und Zeitmessung Neu starten (Netstat)
$diff = TimerDiff($begin1)
$begin1 = TimerInit()

;Zeitversatz abziehen oder draufrechnen (WICHTIG!)
$Up_speed = $Up_speed/($diff/1000)
$Down_speed = $Down_speed/($diff/1000)

$Up_speed = Round(($Up_speed*8)/1024,2); *8 für Byte zu bit /1024 für in kbit
$Down_speed = Round(($Down_speed*8)/1024,2)

$Up_speed_pro = $Up_speed*0.5
$Down_speed_pro = $Down_speed*0.05; 0,05 0.00625

GUICtrlSetData ($Progress1,$Up_speed_pro);Prozessbalken setzen
GUICtrlSetData ($Progress2,$Down_speed_pro)

GUICtrlSetData ($Up,$Up_speed&' kbit/s');Upload Daten setzen
GUICtrlSetData ($Down,$Down_speed&' kbit/s')



; Alte Werte Speichern
; Save Old Values
$UpStr_alt = $UpStr
$DownStr_alt = $DownStr



; Startpunkt auf 0 setzen, wenn getrackt wird
; Starting point to 0 when it is tracked
;; If $Up_speed > 80 Then
;; $start = TimerInit()
;; EndIf

; Zeitliche Differenz berechnen (Tracking)
; Calculate time difference (tracking)
; $ende = TimerDiff($start)

; Tracking beenden, wenn seit >= 30min nicht getrackt wurde
; Tracking exit if not tracked since > = 30min
#cs
If WinExists("DTrack") And $ende >= 1800000 And $Up_speed < 60 Then
WinActivate("DTrack")
MouseMove(20, 50, 1)
MouseClick("left")
Send("!{F4}")
MsgBox(0, "Tracking beendet", "Es gab seit über 30 Minuten keine Tracking-Aktivität." & @CRLF & "Das Tracking wurde beendet")
Exit
EndIf
#ce
WEnd

;netstat -e ausführen und wichtige Werte auslesen
Func _netstat(ByRef $UpStr, ByRef $DownStr)
Local $LineDos
$NetStat = Run(@ComSpec & " /c netstat -e", @SystemDir, @SW_HIDE, 2)
; -------
While 1
; $LineDos = StdoutRead($NetStat, 400)
$LineDos &= StdoutRead($NetStat, False, False)
If @error Then
ExitLoop
EndIf
Sleep(10)
WEnd
; -------

ConsoleWrite($LineDos & @CRLF) ; to see the "netstat -e" output on console
; I assume that the number of bytes sent/received is on line 5 of the "netstat -e" output

$LinesDos = StringSplit($LineDos,@CR) ; each line of dos output in each array element
$Line = StringStripWS($LinesDos[5], 7) ; line number 5, it contains bytes sent and received (remove empty spaces)
$Lines = StringSplit($Line, " ") ; each field of the line in each array element

$DownStr = $Lines[2] ; received bytes
$UpStr = $Lines[3] ; transmitted bytes

#cs ; old extraction
If StringInStr($LineDos,'Byte') = True Then
$Line = _StringBetween ($LineDos,'Bytes','Unicastpakete'); <-- here must be localized (language specific)
$Line = StringStripWS($Line[0], 7)
$Lines = StringSplit($Line, " ")
$UpStr = $Lines[2]
$DownStr = $Lines[1]
EndIf

If ProcessExists($NetStat) Then
; ConsoleWrite("closing cmd"&@LF)
ProcessClose($NetStat)
EndIf
#ce -----------------------
EndFunc ;==>_netstat

;Func _Reset(ByRef $TUp, ByRef $TDwn)
; _netstat($UpStr,$DownStr)
; $Tup = $UpStr
; $Tdwn = $DownStr
;EndFunc

Func _exit()
Exit
EndFunc ;==>_exit

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites
Champak

PincoPoncho, I'm trying to understand your script. Is this thing supposed to register traffic when not doing anything, or does win7 constantly do some type of communications behind the scenes? I have my computer in safe mode and see no active apps or processes beyond safe and this app and I'm getting the following info in the console after 10 min:

Received / Sent
Bytes           197685 / 52812
Unicast packets     252 / 228
Non-unicast packets     2904 / 258
Discards        0 / 0
Errors          0 / 0
Unknown protocols   0


Any info or insight on why I'm seeing this?

Edited by Champak

Share this post


Link to post
Share on other sites
Chimp

..... does win7 constantly do some type of communications behind the scenes? .......

 

I think it's like that,

try to disconnect from internet (or disconnect your network cable) and you will see that traffic goes down to 0

also, have a look >here and >here, It can be of interest


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites
UEZ

Here another one: NetHelper by Yashied


Br,
UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Champak

It may be win7 because this other one is doing the same thing. UEZ, My service gives me 100mbps down and 40mbps up, but this app shows 13mbps down and 5Mbps up. What's wrong? What do I need to change in the app.

If that's off, it makes me wonder if the actual transfer is off.

Edited by Champak

Share this post


Link to post
Share on other sites
UEZ

Champak,

I didn't develope the app. Please ask Yashied.

Thx,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×