Comments (2)
We will need to define consistent message string or integer values(preferable) of a message type which will be sent over the wire when requesting sessions or events data from the websocket API.
Proposal
Below is defined a set of possible message int types usable for the socket message requests and response.
type MessageType int
- Request Message Type values
(Sent by Client and responded to by backend for sessions/events)
FETCH_SESSIONS = 1
FETCH_SESSIONS_REPLY=2
FETCH_EVENTS = 3
FETCH_EVENTS_REPLY=4
- Update Message Type values
(Sent down from backend with new sessions/events update data)
NEW_SESSIONS=5
NEW_EVENTS=6
Message Format
I reason that, to allow a consistent message type which must be used to define request and response sent and received, we need to at least use the structure as below:
type Message struct{
Type MessageType `json:"type"`
Payload interface{} `json:"payload"`
}
-
MessageType
is anint
type which is used to represent the above mentioned message types. -
Payload
: is a generic type which only ever be used when responding from the backend to any request, if a payload is sent along with a requestMessage
then it will be discarded and ignored, as we only want a get/retrieve style requests for the websocket connection API.
Response
All response for the request and data delivered to the client based on internal backend operations will take the form:
type Event struct{
Sensor string `json:"sensor"`
Date time.Time `json:"date"`
Started time.Time `json:"started,omitempty"`
Ended time.Time `json:"ended,omitempty"`
Token string `json:"token,omitempty"`
Location string `json:"location,omitempty"`
Category string `json:"category"`
HostAddr string `json:"host_addr"`
LocalAddr string `json:"local_addr"`
Type EventType `json:"event_type"`
Data interface{} `json:"data"`
Details map[string]interface{} `json:"details"`
SessionID string `json:"session_id,omitempty"`
ContainerID string `json:"container_id,omitempty"`
}
// Possible message sent over the wire.
var newSessions = Message{Type: NewSessions, Payload: []Event{}}
from honeytrap.
I believe we also need a MessageType
for error response as we expect we may recieved invalid requests from the client.
ErrorResponse = 7
Which should received a payload of the follow type:
type ErrorPayload struct{
Request MessageType `json:"request"`
Error string `json:"error"`
}
from honeytrap.
Related Issues (20)
- Problem in build honeytrap
- Build is broken due to honeytrap/netstack being outdated? HOT 2
- Rabbit MQ 14:52:04.894 honeytrap/server dial tcp [::1]:5672: connect: connection refused HOT 6
- SSH simulator run commands HOT 3
- SSH simulator vs ssh jail
- How do I filter a trusted IP?
- Can't start honeytrap
- Honeytrap source install on Centos 7 HOT 3
- Help with registering a new service HOT 2
- log file timeout? HOT 1
- Events from HoneyTrap to ELK (standalone) HOT 2
- Docker compose ES keeps exiting with code 1 HOT 1
- Start ftp service as passive instead of active HOT 2
- JA3 Fingerprint issue HOT 1
- Protocols Don't work HOT 3
- icmp protocol?
- can't connect elasticsearch
- can't test https connections HOT 1
- Honey related
- Log HTTP HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from honeytrap.