Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #8 from binaryedge/development
Browse files Browse the repository at this point in the history
Update master
  • Loading branch information
jveiga committed May 3, 2016
2 parents d7c0abb + 30191bc commit 10b4dda
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,21 @@ Platform client
* Change folder to repo ```cd 40fy-client```
* Set this folder as GOPATH ```export GOPATH=$(pwd)``` (This step is necessary as part of Go [configuration](https://github.com/golang/go/wiki/GOPATH)
* Run install ```make all``` This step will create a binary in bin/

# Usage
* Token
* A Token can be set with the flag ```--token=InsertYourToken``` when using the client, by creating a file with name ```config``` in the same directory as the 40fy-client binary with the content```token="InsertYourToken"```
* Mode Verbose
* When using the ```--verbose``` debug messages are shown.
* Stream
* ``` 40fy-client stream [--token=InsertYourToken] [--job-id=InsertYourJobID]```
* When --job-id=ID is present, the stream will filter jobs with that ID otherwise will show everything from the user's stream.
* Firehose
* ``` 40fy-client firehose [--token=InsertYourToken] [--verbose]```
* Shows jobs run by firehose.
* Create Job
* ```40fy-client create-job [--token=InsertYourToken] -targets=Target -port=InsertPortToScan -sample=SampleSize -modules=ServiceToScan [--verbose] [--redirect]```
* The Targets are a comma separated set of ips, ```8.8.8.8,1.1.1.1```
* The Sample size is the number of results necessary to satisfy a scan
* The Modules are which modules to use in scan, example: http,service,ssl,ssh,vnc [link](https://github.com/binaryedge/api-publicdoc#supported-modules)
* Port to scan.
9 changes: 6 additions & 3 deletions src/github.com/binaryedge/40fy-client/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"bufio"
"bytes"
"encoding/json"
"flag"
"fmt"
Expand Down Expand Up @@ -71,6 +70,10 @@ func (s *StreamCommand) print(pattern string, v interface{}) {
}

type msg struct {
Origin origin `json:"origin"`
}

type origin struct {
JobID string `json:"job_id"`
}

Expand All @@ -80,8 +83,8 @@ func readFromResponse(body io.ReadCloser, jobid string) {
for {
byts, _ := buf.ReadBytes('\n')
json.Unmarshal(byts, msg)
if jobid == msg.JobID {
io.Copy(bytes.NewBuffer(byts), os.Stdout)
if jobid == msg.Origin.JobID {
fmt.Println(string(byts))
}
}
}
Expand Down

0 comments on commit 10b4dda

Please sign in to comment.