Skip to content

Commit

Permalink
Show unicode simbols for sent and received
Browse files Browse the repository at this point in the history
  • Loading branch information
Jānis Mezītis committed Mar 15, 2016
1 parent 4c12cee commit fa45139
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions jvpn.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/perl -CS

# Script to run ncsvc without JAVA gui and web browser

Expand Down Expand Up @@ -515,11 +515,12 @@
while (<STAT>) {
if ($_ =~ m/^\s*${vpnint}:\s*(\d+)(?:\s+\d+){7}\s*(\d+)/) {
print "\r \r";
printf("Duration: %02d:%02d:%02d Sent: %s\tReceived: %s",
int($now / 3600), int(($now % 3600) / 60), int($now % 60),
format_bytes($2), format_bytes($1));
printf("\x{21d1}:%s \x{21d3}:%s %02d:%02d:%02d",
format_bytes($2), format_bytes($1),
int($now / 3600), int(($now % 3600) / 60), int($now % 60));
}
}
printf("Runned for: %02d:%02d:%02d",int($now / 3600), int(($now % 3600) / 60), int($now % 60))
close(STAT);
if(!$exists) {
INT_handler();
Expand Down Expand Up @@ -568,12 +569,13 @@
my $now = time - $start_t;
# printing RX/TX. This packet also contains encription type,
# compression and transport info, but length seems to be variable
printf("Duration: %02d:%02d:%02d Sent: %s\tReceived: %s",
int($now / 3600), int(($now % 3600) / 60), int($now % 60),
format_bytes(unpack('x[78]N',$data)), format_bytes(unpack('x[68]N',$data)));
printf("\x{21d1}:%s \x{21d3}:%s %02d:%02d:%02d",
format_bytes(unpack('x[78]N',$data)), format_bytes(unpack('x[68]N',$data)),
int($now / 3600), int(($now % 3600) / 60), int($now % 60));
sleep(1);
}

printf("Runned for: %02d:%02d:%02d",int($now / 3600), int(($now % 3600) / 60), int($now % 60))
print "Exiting... Connect failed?\n";

$socket->close();
Expand Down

0 comments on commit fa45139

Please sign in to comment.