diff --git a/README.md b/README.md index 6f65068..d63ed50 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Web组件主要用于 # set $GOPATH and $GOROOT mkdir -p $GOPATH/src/github.com/urlooker cd $GOPATH/src/github.com/urlooker -git clone https://github.com/URLooker/web.git +git clone https://github.com/xiaolezheng/web.git cd web go get ./... ./control build diff --git a/cron/fetcher.go b/cron/fetcher.go index d111add..aace604 100644 --- a/cron/fetcher.go +++ b/cron/fetcher.go @@ -80,6 +80,8 @@ func newDetectedItem(s *model.Strategy, ip string, idc string) g.DetectedItem { Sid: s.Id, Keywords: s.Keywords, Data: s.Data, + Method: s.Method, + PostData: s.PostData, Tag: s.Tag, ExpectCode: s.ExpectCode, Timeout: s.Timeout, diff --git a/g/var.go b/g/var.go index c2f3a77..a30a6a6 100644 --- a/g/var.go +++ b/g/var.go @@ -14,11 +14,13 @@ type DetectedItem struct { Sid int64 `json:"sid"` Domain string `json:"domain"` Target string `json:"target"` + Method string `json:"method"` Ip string `json:"ip"` Keywords string `json:"keywords"` Timeout int `json:"timeout"` Creator string `json:"creator"` Data string `json:"data"` + PostData string `json:"post_data` Tag string `json:"tag"` ExpectCode string `json:"expect_code"` Idc string `json:"idc"` diff --git a/handler/stra_handler.go b/handler/stra_handler.go index 8e7a400..75fc2d1 100644 --- a/handler/stra_handler.go +++ b/handler/stra_handler.go @@ -46,6 +46,7 @@ func AddStrategyPost(w http.ResponseWriter, r *http.Request) { var s = model.Strategy{} s.Creator = me.Name s.Url = url + s.Method = param.String(r, "method", "GET") s.ExpectCode = param.String(r, "expect_code", "200") s.Timeout = param.Int(r, "timeout", 3000) s.MaxStep = param.Int(r, "max_step", 3) @@ -54,6 +55,7 @@ func AddStrategyPost(w http.ResponseWriter, r *http.Request) { s.Note = param.String(r, "note", "") s.Keywords = param.String(r, "keywords", "") s.Data = param.String(r, "data", "") + s.PostData = param.String(r, "post_data", "") s.Tag = tagStr _, err = s.Add() @@ -110,6 +112,7 @@ func UpdateStrategy(w http.ResponseWriter, r *http.Request) { s.Creator = username s.Url = url + s.Method = param.String(r, "method", "GET") s.ExpectCode = param.String(r, "expect_code", "200") s.Timeout = param.Int(r, "timeout", 3000) s.MaxStep = param.Int(r, "max_step", 3) @@ -118,6 +121,7 @@ func UpdateStrategy(w http.ResponseWriter, r *http.Request) { s.Note = param.String(r, "note", "") s.Keywords = param.String(r, "keywords", "") s.Data = param.String(r, "data", "") + s.PostData = param.String(r, "post_data", "") s.Tag = tagStr err = s.Update() diff --git a/model/strategy.go b/model/strategy.go index e6a2403..1274821 100644 --- a/model/strategy.go +++ b/model/strategy.go @@ -9,12 +9,14 @@ import ( type Strategy struct { Id int64 `json:"id"` Url string `json:"url"` + Method string `json:"method"` Keywords string `json:"keywords"` Timeout int `json:"timeout"` Creator string `json:"creator"` ExpectCode string `json:"expect_code"` Note string `json:"note"` Data string `json:"data"` + PostData string `json:"post_data"` Tag string `json:"tag"` MaxStep int `json:"max_step"` Times int `json:"times"` diff --git a/schema.sql b/schema.sql index 766af59..60f76fa 100644 --- a/schema.sql +++ b/schema.sql @@ -5,10 +5,12 @@ DROP TABLE IF EXISTS `strategy`; CREATE TABLE `strategy` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `url` varchar(1024) NOT NULL, + `method` varchar(10) NOT NULL DEFAULT 'GET', `keywords` varchar(255) NOT NULL DEFAULT '', `timeout` varchar(255) NOT NULL DEFAULT '', `creator` varchar(255) NOT NULL DEFAULT '', `data` varchar(255) NOT NULL DEFAULT '', + `post_data` varchar(1000) NOT NULL DEFAULT '', `expect_code` varchar(255) NOT NULL DEFAULT '', `tag` varchar(255) NOT NULL DEFAULT '', `note` varchar(255) NOT NULL DEFAULT '', diff --git a/static/js/g.js b/static/js/g.js index d14d842..12a6260 100644 --- a/static/js/g.js +++ b/static/js/g.js @@ -60,9 +60,11 @@ function get_strategy(id){ url = "/strategy/" + id $.post(url, {}, function(res){ $("#url").val(res.data.url) + $("#method").val(res.data.method) $("#expect_code").val(res.data.expect_code) $("#timeout").val(res.data.timeout) $("#data").val(res.data.data) + $("#post_data").val(res.data.post_data) $("#keywords").val(res.data.keywords) $("#note").val(res.data.note) $("#times").val(res.data.times) @@ -74,6 +76,7 @@ function get_strategy(id){ function update_strategy(id){ $.post('/strategy/' + id + '/edit', { "url": $('#url').val(), + "method": $('#method').val(), "expect_code": $('#expect_code').val(), "timeout": $('#timeout').val(), "times": $('#times').val(), @@ -82,7 +85,8 @@ function update_strategy(id){ "tags": $('#tags').val(), "note": $('#note').val(), "keywords": $('#keywords').val(), - "data": $('#data').val() + "data": $('#data').val(), + "post_data": $('#post_data').val() }, function(json) { handle_json(json, function (){location.reload()}) }); @@ -91,6 +95,7 @@ function update_strategy(id){ function add_strategy() { $.post("/strategy/add", { "url": $('#url').val(), + "method": $('#method').val(), "expect_code": $('#expect_code').val(), "timeout": $('#timeout').val(), "times": $('#times').val(), @@ -99,7 +104,8 @@ function add_strategy() { "tags": $('#tags').val(), "note": $('#note').val(), "keywords": $('#keywords').val(), - "data": $('#data').val() + "data": $('#data').val(), + "post_data": $('#post_data').val() }, function(json){ handle_json(json, function(){ location.href=$("/").val(); diff --git a/views/strategy/create.html b/views/strategy/create.html index 046f0b2..0dd3d03 100644 --- a/views/strategy/create.html +++ b/views/strategy/create.html @@ -18,6 +18,17 @@ +
+ +
+ +
+
@@ -69,6 +80,11 @@

+
+ + +
+
diff --git a/views/strategy/edit.html b/views/strategy/edit.html index d12eb12..b55e09e 100644 --- a/views/strategy/edit.html +++ b/views/strategy/edit.html @@ -22,6 +22,17 @@
+
+ +
+ +
+
@@ -72,7 +83,10 @@

- +
+ + +