Skip to content

Commit

Permalink
adding some var to keep variables local
Browse files Browse the repository at this point in the history
  • Loading branch information
kris-watts-gravwell committed Feb 29, 2020
1 parent 4aaa604 commit 8e0d007
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion resources/update_keyed_csv.ank
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module KeyedCSVResource {
if err != nil {
return nil, nil, err
}
rdr = csv.NewReader(bytes.NewBuffer(bts))
var rdr = csv.NewReader(bytes.NewBuffer(bts))
rdr.LazyQuotes = true

//load the headers
Expand Down
20 changes: 10 additions & 10 deletions threatlists/otx/directconnect.ank
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module OTXFeeder {

func getPersistentTimestamp(name) {
//grab a persistent timestamp named
last = pts.Get(name)
var last = pts.Get(name)
if last == pts.zero {
return time.Now().Add(-1 * reachBack)
}
Expand All @@ -105,11 +105,11 @@ module OTXFeeder {
func requestRetry(req) {
for i = 0; i < retries; i++ {
tick() // kick the ticker so everyone knows we are still alive
cli = new(http.Client)
var cli = new(http.Client)
cli.Timeout = requestTimeout
ts = time.Now()
var ts = time.Now()
resp, err = cli.Do(req)
dur = time.Since(ts)
var dur = time.Since(ts)
if err == nil {
return resp, nil
}
Expand Down Expand Up @@ -137,7 +137,7 @@ module OTXFeeder {
return fmt.Errorf("Invalid response code on export request %d", resp.StatusCode)
}

bb = bytes.NewBuffer(nil)
var bb = bytes.NewBuffer(nil)
_, err = io.CopyN(bb, resp.Body, maxPayloadSize)
if err != nil && err != io.EOF {
return err
Expand All @@ -158,22 +158,22 @@ module OTXFeeder {
return nil, errors.New("Invalid indicator type type")
}
uri.Path = `/api/v1/indicators/export`
q = new(url.Values)
ts = getPersistentTimestamp(tp)
var q = new(url.Values)
var ts = getPersistentTimestamp(tp)
ts = ts.Truncate(time.Minute)
q.Add(`modified_since`, toString(ts.Format(time.RFC3339)))
q.Add(`types`, tp)
q.Add(`limit`, toString(perPageLimit))
uri.RawQuery = q.Encode()
reqUrl = uri.String()
ret = map[string][]string{}
var reqUrl = uri.String()
var ret = map[string][]string{}
for reqUrl != nil {
var obj = map[string]interface{}
err = doRequest(reqUrl, &obj)
if err != nil {
return nil, err
}
currTime = time.Now().Format(time.RFC3339)
var currTime = time.Now().Format(time.RFC3339)
for r in obj.results {
try {
if toString(r[`type`]) == tp {
Expand Down

0 comments on commit 8e0d007

Please sign in to comment.