Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Warden Connectors
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
713
Warden
Warden Connectors
Commits
87f7b980
Commit
87f7b980
authored
1 year ago
by
Pavel Valach
Committed by
Daniel Studený
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Cowrie, Dionaea: in the connectors, only output IDEA events with globally routable source IPs
parent
cc23cb8e
No related branches found
No related tags found
1 merge request
!6
Cowrie, Dionaea: in the connectors, only output IDEA events with globally routable source IPs
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cowrie/wardenfiler.py
+7
-1
7 additions, 1 deletion
cowrie/wardenfiler.py
dionaea/log_wardenfiler.py
+8
-1
8 additions, 1 deletion
dionaea/log_wardenfiler.py
with
15 additions
and
2 deletions
cowrie/wardenfiler.py
+
7
−
1
View file @
87f7b980
...
@@ -19,6 +19,7 @@ from datetime import datetime
...
@@ -19,6 +19,7 @@ from datetime import datetime
from
uuid
import
uuid4
from
uuid
import
uuid4
from
hashlib
import
sha1
from
hashlib
import
sha1
from
base64
import
b64encode
from
base64
import
b64encode
from
ipaddress
import
ip_address
from
ipaddress
import
IPv4Network
from
ipaddress
import
IPv4Network
from
ipaddress
import
IPv6Network
from
ipaddress
import
IPv6Network
from
cowrie.core.config
import
CowrieConfig
from
cowrie.core.config
import
CowrieConfig
...
@@ -174,6 +175,11 @@ class Output(cowrie.core.output.Output):
...
@@ -174,6 +175,11 @@ class Output(cowrie.core.output.Output):
entry
[
"
dst_port
"
]
=
self
.
reported_ssh_port
entry
[
"
dst_port
"
]
=
self
.
reported_ssh_port
if
entry
[
"
eventid
"
]
==
'
cowrie.session.connect
'
:
if
entry
[
"
eventid
"
]
==
'
cowrie.session.connect
'
:
# Do not track a session for a source
# which is not globally routable
if
not
ip_address
(
entry
[
"
src_ip
"
]).
is_global
:
return
()
if
self
.
resolve_nat
:
if
self
.
resolve_nat
:
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
.
connect
((
self
.
nat_host
,
self
.
nat_port
))
s
.
connect
((
self
.
nat_host
,
self
.
nat_port
))
...
...
This diff is collapsed.
Click to expand it.
dionaea/log_wardenfiler.py
+
8
−
1
View file @
87f7b980
...
@@ -21,6 +21,7 @@ from datetime import datetime
...
@@ -21,6 +21,7 @@ from datetime import datetime
from
uuid
import
uuid4
from
uuid
import
uuid4
from
hashlib
import
sha1
from
hashlib
import
sha1
from
base64
import
b64encode
from
base64
import
b64encode
from
ipaddress
import
ip_address
from
ipaddress
import
IPv4Network
from
ipaddress
import
IPv4Network
from
ipaddress
import
IPv6Network
from
ipaddress
import
IPv6Network
...
@@ -438,7 +439,13 @@ class LogWardenfilerHandler(ihandler):
...
@@ -438,7 +439,13 @@ class LogWardenfilerHandler(ihandler):
if
con
in
self
.
sessions
:
if
con
in
self
.
sessions
:
s
=
self
.
sessions
[
con
]
s
=
self
.
sessions
[
con
]
if
s
.
get
(
"
cmds
"
):
# Do not generate IDEA event for a source
# which is not globally routable
if
not
ip_address
(
s
[
"
src_ip
"
]).
is_global
:
logger
.
info
(
"
not generating an event for connection from non-global IP %s:%s
"
%
(
con
.
remote
.
host
,
con
.
remote
.
port
))
elif
s
.
get
(
"
cmds
"
):
event
=
self
.
_make_idea
(
con
)
event
=
self
.
_make_idea
(
con
)
self
.
_save_event
(
event
)
self
.
_save_event
(
event
)
logger
.
info
(
"
sending connection event from %s:%i to %s:%i
"
%
(
con
.
remote
.
host
,
con
.
remote
.
port
,
con
.
local
.
host
,
con
.
local
.
port
))
logger
.
info
(
"
sending connection event from %s:%i to %s:%i
"
%
(
con
.
remote
.
host
,
con
.
remote
.
port
,
con
.
local
.
host
,
con
.
local
.
port
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment