Skip to content

Commit 08e83b2

Browse files
author
hack2fun
committed
first commit
0 parents  commit 08e83b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+9678
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.exe
2+
*.zip

.idea/GScan.iml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 110 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Misc/allparams.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package Misc
2+
3+
type HostInfo struct {
4+
INIFile string
5+
Host string
6+
Username string
7+
Password string
8+
ErrShow bool
9+
Ports string
10+
Port int
11+
Help bool
12+
Userfile string
13+
Passfile string
14+
Scantype string
15+
Thread int
16+
Timeout int64
17+
Url string
18+
UrlFile string
19+
Show bool
20+
Output string
21+
Cookie string
22+
Header string
23+
}

Misc/check.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package Misc
2+
3+
import (
4+
"fmt"
5+
"net"
6+
"time"
7+
"os"
8+
)
9+
10+
//Check if port is available
11+
func (h *HostInfo)CheckPort()error{
12+
InfoPrinter.Println("Checking whether the target port is open")
13+
addr:=fmt.Sprintf("%s:%d",h.Host,h.Port)
14+
_,err:=net.DialTimeout("tcp",addr,(time.Duration(h.Timeout))*time.Second)
15+
if err!=nil{
16+
WarnPrinter.Println("Port is closed, please confirm whether the target port is open")
17+
InfoPrinter.Println("If you confirm that the port of this host is open, you can use the -bypass option to bypass port detection")
18+
return err
19+
}else{
20+
InfoPrinter.Println("Port check completed, port open")
21+
InfoPrinter.Println("Starting")
22+
return nil
23+
}
24+
}
25+
26+
func CheckErr(err error){
27+
if err!=nil{
28+
ErrPrinter.Println(err.Error())
29+
os.Exit(0)
30+
}
31+
}

Misc/infoprint.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package Misc
2+
3+
import(
4+
"log"
5+
"os"
6+
"fmt"
7+
)
8+
9+
const REDCOLOR = "\x1B[0;40;31m[Failed] \x1B[0m"
10+
const GREEN = "\x1B[1;40;32m[Succeed] \x1B[0m"
11+
const ERR = "\x1B[0;40;31m[ERROR] \x1B[0m"
12+
const INFO = "\x1B[1;40;32m[*] \x1B[0m"
13+
const WARN = "\x1B[0;40;31m[*] \x1B[0m"
14+
15+
var SucceedPrinter = log.New(os.Stdout,GREEN,log.LstdFlags)
16+
var FailedPrinter = log.New(os.Stdout,REDCOLOR,log.LstdFlags)
17+
var ErrPrinter = log.New(os.Stdout,ERR,log.LstdFlags)
18+
var InfoPrinter = log.New(os.Stdout,INFO,log.LstdFlags)
19+
var WarnPrinter = log.New(os.Stdout,WARN,log.LstdFlags)
20+
// Successful IP, account and password will be output here
21+
func (h *HostInfo)PrintSuccess(){
22+
info:=fmt.Sprintf("Type: %s IP: %s:%d Username: %s Password: %s",h.Scantype,h.Host,h.Port,h.Username,h.Password)
23+
SucceedPrinter.Println(info)
24+
}
25+
26+
func (h *HostInfo)PrintFail(){
27+
info:=fmt.Sprintf("Type: %s IP: %s:%d Username: %s Password: %s",h.Scantype,h.Host,h.Port,h.Username,h.Password)
28+
FailedPrinter.Println(info)
29+
}
30+
31+
//Output alive ports
32+
func (h *HostInfo)PrintSucceedPort(){
33+
info:=fmt.Sprintf("IP: %s:%d",h.Host,h.Port)
34+
SucceedPrinter.Println(info)
35+
}
36+
37+
//Output died ports
38+
func (h *HostInfo)PrintFailedPort(){
39+
info:=fmt.Sprintf("IP: %s:%d",h.Host,h.Port)
40+
FailedPrinter.Println(info)
41+
}
42+
43+
//Output alive hosts
44+
func (h *HostInfo)PrintSucceedHost(){
45+
info:=fmt.Sprintf("IP: %s is aliving",h.Host)
46+
SucceedPrinter.Println(info)
47+
}
48+
49+
//Output died hosts
50+
func (h *HostInfo)PrintFailedHost(){
51+
info:=fmt.Sprintf("IP: %s is died",h.Host)
52+
FailedPrinter.Println(info)
53+
}

Misc/save.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package Misc
2+
3+
import (
4+
"fmt"
5+
"log"
6+
"os"
7+
)
8+
9+
func (h *HostInfo)Save(){
10+
11+
}
12+
13+
func (h *HostInfo)OutputTXT(){
14+
f,err:=os.OpenFile(h.Output,os.O_CREATE|os.O_WRONLY|os.O_APPEND,0666)
15+
if err!=nil {
16+
ErrPrinter.Println(err)
17+
return
18+
}
19+
var SaveFiler = log.New(f,"[*]",log.LstdFlags)
20+
21+
switch h.Scantype {
22+
case "icmp":
23+
info:=fmt.Sprintf("The host %s is up",h.Host)
24+
SaveFiler.Println(info)
25+
case "portscan":
26+
info:=fmt.Sprintf("IP: %s:%d Open",h.Host,h.Port)
27+
SaveFiler.Println(info)
28+
//case "mysql","mssql","postgresql","ftp","mongodb","smb","redis","stmp"
29+
case "urlscan","subdomain":
30+
info:=fmt.Sprintf("%s",h.Url)
31+
SaveFiler.Println(info)
32+
case "auth":
33+
info:=fmt.Sprintf("Type: %s URL: %s Username: %s Password: %s",h.Scantype,h.Url,h.Username,h.Password)
34+
SaveFiler.Println(info)
35+
default:
36+
info:=fmt.Sprintf("Type: %s IP: %s:%d Username: %s Password: %s",h.Scantype,h.Host,h.Port,h.Username,h.Password)
37+
SaveFiler.Println(info)
38+
}
39+
}
40+
41+
func (h *HostInfo)OutputJosn(){
42+
43+
}
44+

Parse/PareseConfig.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package Parse
2+
3+
import (
4+
"errors"
5+
"github.com/go-ini/ini"
6+
"../Misc"
7+
)
8+
9+
var ParseConfigErr=errors.New("An error occurred while parsing the configuration file, please check if your ini file format is correct or the file exists")
10+
11+
var CONFIG = &Misc.HostInfo{}
12+
13+
//Getting information of config file
14+
func GetConfig(filename string)(*Misc.HostInfo,error){
15+
conf,err:=ini.Load(filename)
16+
if err!=nil{
17+
return nil,ParseConfigErr
18+
}
19+
err=conf.Section("CONFIG").MapTo(CONFIG)
20+
if err!=nil{
21+
return nil,ParseConfigErr
22+
}
23+
return CONFIG,nil
24+
}

0 commit comments

Comments
 (0)