forked from jaeles-project/jaeles
-
Notifications
You must be signed in to change notification settings - Fork 2
/
background.go
71 lines (63 loc) · 1.8 KB
/
background.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
package core
import (
"fmt"
"github.com/go-resty/resty/v2"
"github.com/ARPSyndicate/jaeles/utils"
"net/url"
"time"
"github.com/Jeffail/gabs/v2"
"github.com/ARPSyndicate/jaeles/database"
"github.com/ARPSyndicate/jaeles/libs"
)
// Background main function to call other background task
func Background(options libs.Options) {
utils.DebugF("Checking backround task")
time.Sleep(time.Duration(options.Refresh) * time.Second)
// currently disable for now
PollingLog()
PickupLog(options)
// @TODO: Add passive signature for analyzer each request
}
// PollingLog polling all request with their
func PollingLog() {
objs := database.GetUnPollReq()
for _, obj := range objs {
// sending part
secret := url.QueryEscape(database.GetSecretbyCollab(obj.Secret))
URL := fmt.Sprintf("http://polling.burpcollaborator.net/burpresults?biid=%v", secret)
resp, err := resty.New().R().Get(URL)
if err != nil {
continue
}
response := string(resp.Body())
jsonParsed, _ := gabs.ParseJSON([]byte(response))
exists := jsonParsed.Exists("responses")
if exists == false {
continue
} else {
for _, element := range jsonParsed.Path("responses").Children() {
// import this to DB so we don't miss in other detect
database.ImportOutOfBand(fmt.Sprintf("%v", element))
}
}
}
}
// PickupLog pickup request that's have log coming back
func PickupLog(options libs.Options) {
objs := database.GetUnPollReq()
for _, obj := range objs {
interactString := obj.InteractionString
data := database.GetOOB(interactString)
if data != "" {
var rec libs.Record
rec.Request.Beautify = obj.Req
rec.Response.Beautify = obj.Res
rec.ExtraOutput = data
if options.NoOutput == false {
outputName := StoreOutput(rec, options)
rec.RawOutput = outputName
database.ImportRecord(rec)
}
}
}
}