Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a46c855960 | ||
|
|
0ea14fd132 | ||
|
|
7020adee58 | ||
|
|
399459c744 | ||
|
|
b4b01a5cf4 |
No files matched your search
@@ -1,5 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"./timer"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"regexp"
|
"regexp"
|
||||||
@@ -16,7 +18,8 @@ func main() {
|
|||||||
// and then converted byte by byte (2 char at a time)
|
// and then converted byte by byte (2 char at a time)
|
||||||
//fmt.Println(convert_address(reverse_string(reverse_bytes("0100007F"))))
|
//fmt.Println(convert_address(reverse_string(reverse_bytes("0100007F"))))
|
||||||
|
|
||||||
read_tcp_file("/proc/net/tcp")
|
timer.New()
|
||||||
|
tcp_rows(read_tcp_file("/proc/net/tcp"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func check(e error) {
|
func check(e error) {
|
||||||
@@ -25,6 +28,18 @@ func check(e error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func tcp_rows(connections_file string) {
|
||||||
|
regexpression := regexp.MustCompile(`[^a-zA-Z0-9:\r\n\t\v]+`)
|
||||||
|
tcp_lines := strings.Split(connections_file, "\n")
|
||||||
|
|
||||||
|
for _, line := range tcp_lines {
|
||||||
|
trim_line := strings.TrimSpace(line)
|
||||||
|
values := regexpression.ReplaceAllString(trim_line, ",")
|
||||||
|
// Debug
|
||||||
|
// fmt.Println("New Line ==========")
|
||||||
|
fmt.Println(values)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Take a string, create a rune slice, and use a loop to reverse it character-wise.
|
// Take a string, create a rune slice, and use a loop to reverse it character-wise.
|
||||||
func reverse_bytes(s string) string {
|
func reverse_bytes(s string) string {
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package timer
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
//"reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
func New() {
|
||||||
|
|
||||||
|
timer_10s := time.NewTimer(10 * time.Second)
|
||||||
|
// timer_1m := time.NewTimer(1 * time.Minute)
|
||||||
|
fmt.Println("Waiting 10 seconds...")
|
||||||
|
<-timer_10s.C
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// for elapsed < ten_seconds {
|
||||||
|
//}
|
||||||
|
// for
|
||||||
|
}
|
||||||
Reference in new issue
Block a user