-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Lua scripting in honeytrap #427
Open
martijnjanssen
wants to merge
2
commits into
honeytrap:master
Choose a base branch
from
HoneyBEP:feature-lua
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Expand Lua service Revert unwanted changes Add command line option to disable lua scripting Add scripters, scripter config and services scripter initialization Integrate basic lua scripting into the http service Update http server and lua implementation (#3) * Update http server and lua implementation * Update wordpress links * Update http * Update config sample with scripters * ÃUpdate scripter register function * Fix gitignore * Update SetVariable function * Update Lua variables * Update variables and http * Remove newline and old .lua file Feature support multiple scripts per service (#5) * Added support for multiple lua scripts for one service * Added example for multiple scripts per service Feature lua functions (#4) * Update lua string functions * Update datetime function * Add name to scripter to avoid unneeded arguments (#6) Fix unneeded arguments * Fix formatting * Fix methods and variable names Remove lua variable function (#8) * Update lua string functions * Update datetime function * Add name to scripter to avoid unneeded arguments (#6) Fix unneeded arguments * Remove lua variable function * Update functions names * Fix comment and space * Delete HTTP map Update http lua script for uniform requirements (#9) * Update http lua script for uniform requirements * Update template and remove unused files * Update template.lua Feature lua state per connection (#12) * Initial setup * Lua scripts are loaded for each connection * Added commenting * Remove unneeded info log's * Remove unneeded comments * Fixed not returning errors * Only give error on loading the script * Continue after script load error * Removed unneeded cancelFunctions Feature lua float function (#7) * Update lua string functions * Update integer function lua * Remove duplicate function * Update comment on function * Add service name to SetFloatFunction * Fixed Floatfunction to new connectionStruct Delete lua-scripts for submodule (#13) * Delete lua-scripts for submodule * Update new commits * Update for travis build * Update submodule init for lua-scripts * Update travis ssh rewrite * Update travis again * Update travis again * Gopher-lua in vendor * Update travis again * Update travis again * Update travis again * Update travis again * Update lua-scripts to public repo * Remove update from package for HoneyBEP * Update lua Feature parameter function (#14) * Update parameter function * Update file permission * Update comments Added gopher-lua without submodule (#15) Move global methods to lua scripter object (#17) Feature ssh lua implementation (#18) * SSH lua implementation in exec and channel * Update scripts * Added error handling and default result * Show error when handling of lua goes wrong Feature ab testing (#19) * SSH lua implementation in exec and channel * Added abtester interface and struct * Finished inital setup abtesting * Better error handling and comments Feature SSH uname AB Testing (#20) * Update ab testing for uname * Update random int * Update lua-scripts Refactored scripts to split data better (#21) * Refactored scripts to split data better * Minor go format change Added a logging method for the scripts (#22) * Added a logging method for the scripts * Correct return value for void function * Split Ab tester from scripter intreface Fix Handle Parameter and possibility of empty response (#23) * Fix result return * Update parameters * Fix index * Update util file get create dir * fix comments * Fix unwanted code * Update fix for basic methods Add generic scripter (#24) * Add generic scripter * Add better comments that comply with gometalinter * Fix field names in struct * Add missing commend & fix error returns Implement scripter method & generic scripter expansion (#26) * Added rest support for lua scripts * Added rest response for lua * Added better rest responses * Add destination and source ip to channelsend * Removed honeytrap binary * Added honeytrap binary to gitignore * Remove binary * Remove binary pt. 2 * Move html methods to generic scripter * Extract setBasicMethods * Extract lua methods * Fix import & rename ssh-simulator service * Add missing comments Made the channel send, also send the response along (#32) * Made the channel send, also send the response along * Fix response naming and sending of event in SSH Simulator * Fix double response Feature: reload Lua scripts (#25) * Update lua refresh scripts * Update gitignore for download files * Fix for loading folders as lua scripts * Fix for fix for dir * Update comment and reload for http * Update to reload when files are created or deleted * Update scripts for generic scripter instead of only lua * Update checksum for edited or new files * SetInterval update with duration definition * Update naming for function * Update uname json for extra test cases (#27) * Lua scripts update for branch * Update uname json for extra test cases * Fixed the reload of scripts via web call * Remove the interval setup for lua * Update abtests.json * Remove redundent files * Update file requests for Honeytrap (#28) * Update file requests for Honeytrap * Update scripts for endpoint controle * Delete submodule * Update submodules * Fix scripts load in folder * Update new scripts folder * Remove hash functions * Fix scripter relation for update * Update for different files and license * Update web commands into seperate functions * Fix build error * Update get channel for scripters * Reset vendor honeytrap-web * Fix basic methods Fix submodule for scripts Feature scripter path in lua (#33) * Set scripter path for each lua script * Added folder path in lua scripts Fix double write over connection (#34) Fix web initialization (#36) * Fix web initialization * Update to not global web * Fix for canHandle of scripts * Update scripts to latest Extract abtester as separate entity (#35) Travis build restart Add comment Add cleanuptask for unused scripterConnections (#39) * Added interval for cleaning unused scripterConnections * Renamed constants and removed unneeded code * Added missing comment * Submodule fix * Added debug log on remaining connections Add config setting for scripter connection cleanup (#40) Tests for generic service with Lua (#37) (#41) * Init tests for generic service with Lua (#37) * Init tests for generic service with Lua * Added more test cases * Fix tests with context * Update packages * Fix tests and generic services based on tests * Fix preloadLimit error gopher lua * Fix a lot of tests for the scripter of lua * Add comments * Updated tests with more tests * Test the scripter interface * rewrite method functions * Updated tests and comments * Fix basepath for tests * Update scripter test init * Update test scripts folder * Fixed dummy with clean connections * Fix last used method on dummy * Fix log of error in scripter Fix non lua extension reading of files (#42) Fix rewrite big methods (#44) * Fix non lua extension reading of files * fix rewrite big methods Improve loglevels & fix formatting (#45) Skip cleanup without connections & remove http service changes Remove irrelevant code Check whether Lua scripts folder exists Final changes
Codecov Report
@@ Coverage Diff @@
## master #427 +/- ##
==========================================
+ Coverage 41.62% 42.99% +1.37%
==========================================
Files 78 86 +8
Lines 8810 9310 +500
==========================================
+ Hits 3667 4003 +336
- Misses 4718 4838 +120
- Partials 425 469 +44
Continue to review full report at Codecov.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Documentation is also on the way, but if there are questions now, feel free to ask.
Currently, Lua scripting is enabled in both the generic scripter and in the ssh-service. If it is wanted in any other places, some (but minimal) glue-code is required to enable it. The easiest example is the ssh-simulator.
To enable reloading of the scripts, a pr is opened at honeytrap-web, merging that does require a update of the vendor package in here before it is enabled. If testing for the reload is required, checking out the HoneyBEP/honeytrap-web master branch is enough to enable it in honeytrap.