-
Notifications
You must be signed in to change notification settings - Fork 2
/
Tekium_PAN_Hunter_Script.go
81 lines (70 loc) · 2.73 KB
/
Tekium_PAN_Hunter_Script.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package main
import (
"fmt"
"os"
"flag"
"io/ioutil"
"log"
"regexp"
)
func main() {
path_search := flag.String("path_search", "C:\\", "PAN's search path")
filters := flag.String("filters", "*.csv", "Search filters")
fmt.Println("-------------------------------------------------------------------------------")
fmt.Println("Copyright©Tekium 2023. All rights reserved.")
fmt.Println("Author: Erick Roberto Rodriguez Rodriguez")
fmt.Println("Email: erodriguez@tekium.mx, erickrr.tbd93@gmail.com")
fmt.Println("GitHub: https://github.com/erickrr-bd/Tekium-PAN-Hunter-Script")
fmt.Println("Tekium PAN Hunter Script v1.1.2 - September 2023")
fmt.Println("-------------------------------------------------------------------------------")
hostname, error := os.Hostname()
if error != nil {
fmt.Println(error)
os.Exit(1)
}
flag.Parse()
fmt.Println("Hostname:", hostname)
fmt.Println("Path:", *path_search)
fmt.Println("Filters:", *filters)
//regex_amex := "([^0-9-]|^)(3(4[0-9]{2}|7[0-9]{2})( |-|)[0-9]{6}( |-|)[0-9]{5})([^0-9-]|$)"
regex_visa := "([^0-9-]|^)(4[0-9]{3}( |-|)([0-9]{4})( |-|)([0-9]{4})( |-|)([0-9]{4}))([^0-9-]|$)"
//regex_master := "([^0-9-]|^)(5[0-9]{3}( |-|)([0-9]{4})( |-|)([0-9]{4})( |-|)([0-9]{4}))([^0-9-]|$)"
file, err := ioutil.ReadFile("/home/erodriguez/Documentos/Projects/prueba.txt")
if err != nil{
log.Fatal(err)
}
boolean, err := regexp.Match(regex_visa, file)
if err != nil{
log.Fatal(err)
}
fmt.Println(boolean)
visa := regexp.MustCompile("([^0-9-]|^)(4[0-9]{3}( |-|)([0-9]{4})( |-|)([0-9]{4})( |-|)([0-9]{4}))([^0-9-]|$)")
allSubstringMatches := visa.FindAllString(file, -1)
//pattern := regexp.MustCompile("H[a-z]{4}|[A-z]ork")
//welcomeMessage := "Hello guys, welcome to new york city"
//allSubstringMatches := pattern.FindAllString(welcomeMessage, -1)
fmt.Println(allSubstringMatches)
//func IsExist(str, filepath string) bool {
// b, err := ioutil.ReadFile(filepath)
// if err != nil {
// panic(err)
// }
// isExist, err := regexp.Match(str, b)
// if err != nil {
// panic(err)
// }
// return isExist
//}
//archivos, err := ioutil.ReadDir(path_search)
//if err != nil {
// log.Fatal(err)
//}
//for _, archivo := range archivos {
// fmt.Println("Nombre:", archivo.Name())
// fmt.Println("Tamaño:", archivo.Size())
// fmt.Println("Modo:", archivo.Mode())
// fmt.Println("Ultima modificación:", archivo.ModTime())
// fmt.Println("Es directorio?:", archivo.IsDir())
// fmt.Println("-----------------------------------------")
//}
}