repo
stringlengths
2
99
file
stringlengths
14
239
code
stringlengths
20
3.99M
file_length
int64
20
3.99M
avg_line_length
float64
9.73
128
max_line_length
int64
11
86.4k
extension_type
stringclasses
1 value
cowrie
cowrie-master/src/cowrie/output/malshare.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
3,275
31.117647
75
py
cowrie
cowrie-master/src/cowrie/output/s3.py
""" Send downloaded/uplaoded files to S3 (or compatible) """ from __future__ import annotations from typing import Any from configparser import NoOptionError from botocore.exceptions import ClientError from botocore.session import get_session from twisted.internet import defer, threads from twisted.python import l...
3,019
29.505051
86
py
cowrie
cowrie-master/src/cowrie/output/socketlog.py
from __future__ import annotations import json import socket import cowrie.core.output from cowrie.core.config import CowrieConfig class Output(cowrie.core.output.Output): """ socketlog output """ def start(self): self.timeout = CowrieConfig.getint("output_socketlog", "timeout") addr...
1,156
25.906977
73
py
cowrie
cowrie-master/src/cowrie/output/greynoise.py
""" Send attackers IP to GreyNoise """ from __future__ import annotations import treq from twisted.internet import defer, error from twisted.python import log import cowrie.core.output from cowrie.core.config import CowrieConfig COWRIE_USER_AGENT = "Cowrie Honeypot" GNAPI_URL = "https://api.greynoise.io/v3/communit...
2,749
27.947368
109
py
cowrie
cowrie-master/src/cowrie/core/checkers.py
""" This module contains ... """ from __future__ import annotations from sys import modules from zope.interface import implementer from twisted.conch import error from twisted.conch.ssh import keys from twisted.cred.checkers import ICredentialsChecker from twisted.cred.credentials import ISSHPrivateKey from twiste...
4,224
32.007813
112
py
cowrie
cowrie-master/src/cowrie/core/auth.py
""" This module contains authentication code """ from __future__ import annotations import json import re from collections import OrderedDict from os import path from random import randint from typing import Any, Union from re import Pattern from twisted.python import log from cowrie.core.config import CowrieConfi...
8,448
31.003788
88
py
cowrie
cowrie-master/src/cowrie/core/credentials.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
3,261
31.949495
80
py
cowrie
cowrie-master/src/cowrie/core/utils.py
# -*- test-case-name: cowrie.test.utils -*- from __future__ import annotations import configparser from typing import BinaryIO from twisted.application import internet from twisted.internet import endpoints def durationHuman(duration: float) -> str: """ Turn number of seconds into human readable string ...
4,153
30
105
py
cowrie
cowrie-master/src/cowrie/core/realm.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
2,435
41
75
py
cowrie
cowrie-master/src/cowrie/core/artifact.py
""" This module contains code to handling saving of honeypot artifacts These will typically be files uploaded to the honeypot and files downloaded inside the honeypot, or input being piped in. Code behaves like a normal Python file handle. Example: with Artifact(name) as f: f.write("abc") or: g = ...
2,319
24.217391
106
py
cowrie
cowrie-master/src/cowrie/core/cef.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
4,079
33.576271
75
py
cowrie
cowrie-master/src/cowrie/core/output.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
7,999
31.653061
88
py
cowrie
cowrie-master/src/cowrie/core/ttylog.py
# -*- test-case-name: cowrie.test.utils -*- """ Should be compatible with user mode linux """ from __future__ import annotations import hashlib import struct OP_OPEN, OP_CLOSE, OP_WRITE, OP_EXEC = 1, 2, 3, 4 TYPE_INPUT, TYPE_OUTPUT, TYPE_INTERACT = 1, 2, 3 TTYSTRUCT = "<iLiiLL" def ttylog_open(logfile: str, stam...
2,437
25.215054
82
py
cowrie
cowrie-master/src/cowrie/telnet_proxy/server_transport.py
""" Telnet Transport and Authentication for the Honeypot @author: Olivier Bilodeau <obilodeau@gosecure.ca> """ from __future__ import annotations import time import uuid from twisted.conch.telnet import TelnetTransport from twisted.internet import reactor from twisted.internet.endpoints import TCP4ClientEndpoint fr...
7,303
34.629268
111
py
cowrie
cowrie-master/src/cowrie/telnet_proxy/client_transport.py
# All rights reserved. from __future__ import annotations from twisted.conch.telnet import TelnetTransport from twisted.internet import protocol from twisted.protocols.policies import TimeoutMixin from twisted.python import log class BackendTelnetTransport(TelnetTransport, TimeoutMixin): def __init__(self): ...
2,253
30.746479
90
py
cowrie
cowrie-master/src/cowrie/telnet_proxy/handler.py
from __future__ import annotations import os import re import time from twisted.python import log from cowrie.core import ttylog from cowrie.core.checkers import HoneypotPasswordChecker from cowrie.core.config import CowrieConfig def process_backspaces(s: bytes) -> bytes: """ Takes a user-input string that ...
12,570
35.75731
122
py
cowrie
cowrie-master/src/cowrie/python/logfile.py
# -*- test-case-name: cowrie.test.utils -*- from __future__ import annotations from os import environ from twisted.logger import textFileLogObserver from twisted.python import logfile from cowrie.core.config import CowrieConfig class CowrieDailyLogFile(logfile.DailyLogFile): """ Overload original Twisted...
1,281
27.488889
83
py
cowrie
cowrie-master/src/cowrie/telnet/userauth.py
""" Telnet Transport and Authentication for the Honeypot @author: Olivier Bilodeau <obilodeau@gosecure.ca> """ from __future__ import annotations import struct from twisted.conch.telnet import ( ECHO, LINEMODE, NAWS, SGA, AuthenticatingTelnetProtocol, ITelnetProtocol, ) from twisted.python i...
4,827
31.186667
82
py
cowrie
cowrie-master/src/cowrie/telnet/factory.py
""" Telnet Transport and Authentication for the Honeypot @author: Olivier Bilodeau <obilodeau@gosecure.ca> """ from __future__ import annotations import time from twisted.cred import portal as tp from twisted.internet import protocol from twisted.plugin import IPlugin from twisted.python import log from cowrie.cor...
2,489
28.294118
93
py
cowrie
cowrie-master/src/cowrie/telnet/session.py
""" Telnet User Session management for the Honeypot @author: Olivier Bilodeau <obilodeau@gosecure.ca> """ from __future__ import annotations import traceback from zope.interface import implementer from twisted.conch.ssh import session from twisted.conch.telnet import ECHO, SGA, TelnetBootstrapProtocol from twisted...
5,044
29.575758
116
py
cowrie
cowrie-master/src/cowrie/telnet/transport.py
""" Telnet Transport and Authentication for the Honeypot @author: Olivier Bilodeau <obilodeau@gosecure.ca> """ from __future__ import annotations import time import uuid from twisted.conch.telnet import AlreadyNegotiating, TelnetTransport from twisted.protocols.policies import TimeoutMixin from twisted.python impo...
4,310
37.491071
117
py
cowrie
cowrie-master/src/cowrie/pool_interface/client.py
from __future__ import annotations import struct from twisted.internet.protocol import ClientFactory, Protocol from twisted.python import log from cowrie.core.config import CowrieConfig class PoolClient(Protocol): """ Represents the connection between a protocol instance (SSH or Telnet) and a QEMU pool ...
3,888
29.622047
89
py
cowrie
cowrie-master/src/cowrie/pool_interface/handler.py
from __future__ import annotations import os from twisted.internet import reactor from twisted.internet.endpoints import TCP4ClientEndpoint from twisted.python import log from cowrie.pool_interface.client import PoolClientFactory class PoolNotReadyError(Exception): pass class PoolHandler: """ When t...
2,547
33.432432
118
py
cowrie
cowrie-master/src/cowrie/ssh_proxy/userauth.py
from __future__ import annotations from twisted.conch.ssh.common import getNS from cowrie.ssh import userauth # object is added for Python 2.7 compatibility (#1198) - as is super with args class ProxySSHAuthServer(userauth.HoneyPotSSHUserAuthServer): def __init__(self): super().__init__() self....
1,168
29.763158
81
py
cowrie
cowrie-master/src/cowrie/ssh_proxy/server_transport.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
17,117
38.442396
117
py
cowrie
cowrie-master/src/cowrie/ssh_proxy/client_transport.py
# All rights reserved. from __future__ import annotations from typing import Any from twisted.conch.ssh import transport from twisted.internet import defer, protocol from twisted.protocols.policies import TimeoutMixin from twisted.python import log from cowrie.core.config import CowrieConfig from cowrie.ssh_proxy.u...
7,288
38.188172
118
py
cowrie
cowrie-master/src/cowrie/ssh_proxy/util.py
from __future__ import annotations import struct def string_to_hex(message: str) -> bytes: b = message.encode("utf-8") size = struct.pack(">L", len(b)) return size + b def bin_string_to_hex(message: bytes) -> bytes: size = struct.pack(">L", len(message)) return size + message def int_to_hex(va...
376
19.944444
47
py
cowrie
cowrie-master/src/cowrie/ssh_proxy/protocols/sftp.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
13,833
39.332362
119
py
cowrie
cowrie-master/src/cowrie/ssh_proxy/protocols/base_protocol.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
3,127
33.755556
105
py
cowrie
cowrie-master/src/cowrie/ssh_proxy/protocols/exec_term.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
4,025
37.342857
81
py
cowrie
cowrie-master/src/cowrie/ssh_proxy/protocols/ssh.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
16,858
39.820823
120
py
cowrie
cowrie-master/src/cowrie/ssh_proxy/protocols/term.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
9,070
38.960352
88
py
cowrie
cowrie-master/src/cowrie/ssh_proxy/protocols/port_forward.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
1,927
43.837209
91
py
cowrie
cowrie-master/src/cowrie/commands/wc.py
# All rights reserved. # All rights given to Cowrie project """ This module contains the wc commnad """ from __future__ import annotations import getopt import re from twisted.python import log from cowrie.shell.command import HoneyPotCommand commands = {} class Command_wc(HoneyPotCommand): """ wc comman...
4,525
32.279412
96
py
cowrie
cowrie-master/src/cowrie/commands/nc.py
from __future__ import annotations import getopt import ipaddress import re import socket import struct from cowrie.core.config import CowrieConfig from cowrie.shell.command import HoneyPotCommand long = int commands = {} def makeMask(n: int) -> int: """ return a mask of n bits as a long integer """ ...
3,568
23.278912
89
py
cowrie
cowrie-master/src/cowrie/commands/base.py
from __future__ import annotations import codecs import datetime import getopt import random import re import time from typing import Optional from collections.abc import Callable from twisted.internet import error, reactor from twisted.python import failure, log from cowrie.core import utils from cowrie.shell.com...
41,589
34.486348
188
py
cowrie
cowrie-master/src/cowrie/commands/chpasswd.py
# All rights reserved. # All rights given to Cowrie project """ This module contains the chpasswd commnad """ from __future__ import annotations import getopt from twisted.python import log from cowrie.shell.command import HoneyPotCommand commands = {} class Command_chpasswd(HoneyPotCommand): def help(self)...
3,241
30.475728
99
py
cowrie
cowrie-master/src/cowrie/commands/which.py
from __future__ import annotations from cowrie.shell.command import HoneyPotCommand commands = {} class Command_which(HoneyPotCommand): # Do not resolve args resolve_args = False def call(self) -> None: """ Look up all the arguments on PATH and print each (first) result """ ...
806
23.454545
72
py
cowrie
cowrie-master/src/cowrie/commands/sleep.py
# All rights reserved. """ This module contains the sleep command """ from __future__ import annotations import re from twisted.internet import reactor from cowrie.shell.command import HoneyPotCommand commands = {} class Command_sleep(HoneyPotCommand): """ Sleep """ pattern = re.compile(r"(\d+)...
1,038
21.586957
98
py
cowrie
cowrie-master/src/cowrie/commands/scp.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
7,501
32.641256
88
py
cowrie
cowrie-master/src/cowrie/commands/free.py
# All rights reserved. """ This module ... """ from __future__ import annotations import getopt from math import floor from cowrie.shell.command import HoneyPotCommand commands = {} FREE_OUTPUT = """ total used free shared buff/cache available Mem:{MemTotal:>15}{calc_total_used:...
3,550
29.878261
118
py
cowrie
cowrie-master/src/cowrie/commands/yum.py
from __future__ import annotations import hashlib import random import re from typing import Any, Optional from collections.abc import Callable from twisted.internet import defer from twisted.internet import reactor from twisted.internet.defer import inlineCallbacks from twisted.python import log from cowrie.she...
12,980
38.099398
120
py
cowrie
cowrie-master/src/cowrie/commands/curl.py
from __future__ import annotations import getopt import ipaddress import os from typing import Optional from twisted.internet import error from twisted.python import compat, log import treq from cowrie.core.artifact import Artifact from cowrie.core.config import CowrieConfig from cowrie.shell.command import HoneyP...
18,683
41.367347
128
py
cowrie
cowrie-master/src/cowrie/commands/iptables.py
from __future__ import annotations import optparse from typing import Any, Optional from cowrie.shell.command import HoneyPotCommand commands = {} class OptionParsingError(RuntimeError): def __init__(self, msg: str) -> None: self.msg = msg class OptionParsingExit(Exception): def __init__(self, ...
16,309
32.150407
114
py
cowrie
cowrie-master/src/cowrie/commands/ftpget.py
from __future__ import annotations import ftplib import getopt import os import socket from typing import Optional, Union from twisted.python import log from cowrie.core.artifact import Artifact from cowrie.core.config import CowrieConfig from cowrie.shell.command import HoneyPotCommand commands = {} class FTP(f...
9,880
29.781931
87
py
cowrie
cowrie-master/src/cowrie/commands/perl.py
# All rights reserved. """ This module contains the perl command """ from __future__ import annotations import getopt from twisted.python import log from cowrie.shell.command import HoneyPotCommand commands = {} class Command_perl(HoneyPotCommand): def version(self) -> None: output = ( "...
5,032
38.629921
101
py
cowrie
cowrie-master/src/cowrie/commands/fs.py
""" Filesystem related commands """ from __future__ import annotations import copy import getopt import os.path import re from collections.abc import Callable from twisted.python import log from cowrie.shell import fs from cowrie.shell.command import HoneyPotCommand commands: dict[str, Callable] = {} class Com...
20,701
30.947531
90
py
cowrie
cowrie-master/src/cowrie/commands/apt.py
from __future__ import annotations import random import re from typing import Any, Optional from collections.abc import Callable from twisted.internet import defer, reactor from twisted.internet.defer import inlineCallbacks from cowrie.shell.command import HoneyPotCommand commands = {} class Command_faked_packa...
7,618
35.109005
98
py
cowrie
cowrie-master/src/cowrie/commands/sudo.py
from __future__ import annotations import getopt from cowrie.shell.command import HoneyPotCommand from cowrie.shell.honeypot import StdOutStdErrEmulationProtocol commands = {} sudo_shorthelp = ( ( """ sudo: Only one of the -e, -h, -i, -K, -l, -s, -v or -V options may be specified usage: sudo [-D level] -...
5,193
36.637681
166
py
cowrie
cowrie-master/src/cowrie/commands/uniq.py
""" uniq command """ from __future__ import annotations from twisted.python import log from cowrie.shell.command import HoneyPotCommand commands = {} UNIQ_HELP = """Usage: uniq [OPTION]... [INPUT [OUTPUT]] Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard output). With...
3,069
33.494382
77
py
cowrie
cowrie-master/src/cowrie/commands/awk.py
# Contributor: Fosocles """ awk command limited implementation that only supports `print` command. """ from __future__ import annotations import getopt import re from typing import Optional from re import Match from twisted.python import log from cowrie.shell.command import HoneyPotCommand from cowrie.shell.fs im...
7,810
31.410788
101
py
cowrie
cowrie-master/src/cowrie/commands/finger.py
from __future__ import annotations from cowrie.shell.command import HoneyPotCommand import datetime import getopt commands = {} FINGER_HELP = """Usage:""" class Command_finger(HoneyPotCommand): def call(self): time = datetime.datetime.utcnow() user_data = [] # Get all user data and conve...
5,199
39.310078
84
py
cowrie
cowrie-master/src/cowrie/commands/ulimit.py
# All rights reserved. """ This module ... """ from __future__ import annotations import getopt from cowrie.shell.command import HoneyPotCommand commands = {} class Command_ulimit(HoneyPotCommand): """ ulimit ulimit: usage: ulimit [-SHacdfilmnpqstuvx] [limit] """ def call(self) -> None: ...
1,100
21.9375
78
py
cowrie
cowrie-master/src/cowrie/commands/ls.py
from __future__ import annotations import getopt import os.path import stat import time from cowrie.shell import fs from cowrie.shell.command import HoneyPotCommand from cowrie.shell.pwd import Group, Passwd commands = {} class Command_ls(HoneyPotCommand): def uid2name(self, uid: int) -> str: try: ...
6,339
30.7
87
py
cowrie
cowrie-master/src/cowrie/commands/cat.py
""" cat command """ from __future__ import annotations import getopt from typing import Optional from twisted.python import log from cowrie.shell.command import HoneyPotCommand from cowrie.shell.fs import FileNotFound commands = {} class Command_cat(HoneyPotCommand): """ cat command """ number...
4,155
28.062937
95
py
cowrie
cowrie-master/src/cowrie/commands/ping.py
from __future__ import annotations import getopt import hashlib import random import re import socket from typing import Any from twisted.internet import reactor from cowrie.shell.command import HoneyPotCommand commands = {} class Command_ping(HoneyPotCommand): """ ping command """ host: str ...
3,730
28.377953
95
py
cowrie
cowrie-master/src/cowrie/commands/netstat.py
# Based on work by Peter Reuteras (https://bitbucket.org/reuteras/kippo/) from __future__ import annotations import socket from cowrie.shell.command import HoneyPotCommand commands = {} class Command_netstat(HoneyPotCommand): def show_version(self) -> None: self.write("net-tools 1.60\n") self....
9,000
42.694175
99
py
cowrie
cowrie-master/src/cowrie/commands/ssh.py
from __future__ import annotations import getopt import hashlib import re import socket import time from collections.abc import Callable from twisted.internet import reactor from twisted.python import log from cowrie.core.config import CowrieConfig from cowrie.shell.command import HoneyPotCommand commands = {} ...
4,706
29.367742
88
py
cowrie
cowrie-master/src/cowrie/commands/tar.py
from __future__ import annotations import os import tarfile from twisted.python import log from cowrie.shell.command import HoneyPotCommand from cowrie.shell.fs import A_REALFILE commands = {} class Command_tar(HoneyPotCommand): def mkfullpath(self, path: str, f: tarfile.TarInfo) -> None: components,...
2,737
32.802469
84
py
cowrie
cowrie-master/src/cowrie/commands/groups.py
from __future__ import annotations import getopt from cowrie.shell.command import HoneyPotCommand commands = {} GROUPS_HELP = """Usage: groups [OPTION]... [USERNAME]... Print group memberships for each USERNAME or, if no USERNAME is specified, for the current process (which may differ if the groups database has chang...
3,266
34.129032
105
py
cowrie
cowrie-master/src/cowrie/commands/busybox.py
from __future__ import annotations from twisted.python import log from cowrie.shell.command import HoneyPotCommand from cowrie.shell.honeypot import StdOutStdErrEmulationProtocol commands = {} busybox_help = ( ( """ BusyBox v1.20.2 (Debian 1:1.20.0-7) multi-call binary. Copyright (C) 1998-2011 Erik Ande...
3,963
35.703704
81
py
cowrie
cowrie-master/src/cowrie/commands/crontab.py
# All rights reserved. # All rights given to Cowrie project """ This module contains the crontab commnad """ from __future__ import annotations import getopt from twisted.python import log from cowrie.shell.command import HoneyPotCommand commands = {} class Command_crontab(HoneyPotCommand): def help(self) -...
2,134
26.025316
75
py
cowrie
cowrie-master/src/cowrie/commands/chmod.py
from __future__ import annotations import getopt import re from cowrie.shell.command import HoneyPotCommand commands = {} CHMOD_HELP = """Usage: chmod [OPTION]... MODE[,MODE]... FILE... or: chmod [OPTION]... OCTAL-MODE FILE... or: chmod [OPTION]... --reference=RFILE FILE... Change the mode of each FILE to MO...
5,277
35.150685
96
py
cowrie
cowrie-master/src/cowrie/commands/service.py
# All rights reserved. """ This module contains the service commnad """ from __future__ import annotations import getopt from cowrie.shell.command import HoneyPotCommand commands = {} class Command_service(HoneyPotCommand): """ By Giannis Papaioannou <giannispapcod7@gmail.com> """ def status_all...
3,449
27.278689
107
py
cowrie
cowrie-master/src/cowrie/commands/tftp.py
from __future__ import annotations import tftpy from tftpy.TftpPacketTypes import TftpPacketDAT, TftpPacketOACK from twisted.python import log from cowrie.core.artifact import Artifact from cowrie.core.config import CowrieConfig from cowrie.shell.command import HoneyPotCommand from cowrie.shell.customparser import Cu...
4,332
31.096296
89
py
cowrie
cowrie-master/src/cowrie/commands/unzip.py
from __future__ import annotations import os import zipfile from twisted.python import log from cowrie.shell.command import HoneyPotCommand from cowrie.shell.fs import A_REALFILE commands = {} class Command_unzip(HoneyPotCommand): def mkfullpath(self, path: str) -> None: components, d = path.split("/...
5,357
44.02521
99
py
cowrie
cowrie-master/src/cowrie/commands/wget.py
from __future__ import annotations import getopt import ipaddress import os import time from typing import Any, Optional from twisted.internet import error from twisted.python import compat, log from twisted.web.iweb import UNKNOWN_LENGTH import treq from cowrie.core.artifact import Artifact from cowrie.core.confi...
11,157
30.971347
128
py
cowrie
cowrie-master/src/cowrie/commands/tee.py
""" tee command """ from __future__ import annotations import getopt import os from typing import Optional from twisted.python import log from cowrie.shell.command import HoneyPotCommand from cowrie.shell.fs import FileNotFound commands = {} class Command_tee(HoneyPotCommand): """ tee command """ ...
4,597
28.474359
95
py
cowrie
cowrie-master/src/cowrie/commands/last.py
from __future__ import annotations import time from cowrie.shell.command import HoneyPotCommand commands = {} class Command_last(HoneyPotCommand): def call(self) -> None: line = list(self.args) while len(line): arg = line.pop(0) if not arg.startswith("-"): ...
1,299
24.490196
81
py
cowrie
cowrie-master/src/cowrie/commands/du.py
from __future__ import annotations import os from cowrie.shell.command import HoneyPotCommand from cowrie.shell.fs import A_NAME commands = {} class Command_du(HoneyPotCommand): def message_help(self) -> str: return """Usage: du [OPTION]... [FILE]... or: du [OPTION]... --files0-from=F Summarize dis...
6,062
44.931818
80
py
cowrie
cowrie-master/src/cowrie/commands/dd.py
""" dd commands """ from __future__ import annotations import re from twisted.python import log from cowrie.shell.command import HoneyPotCommand from cowrie.shell.fs import FileNotFound commands = {} class Command_dd(HoneyPotCommand): """ dd command """ ddargs: dict[str, str] = {} def star...
4,279
28.517241
84
py
cowrie
cowrie-master/src/cowrie/commands/uname.py
""" uname command """ from __future__ import annotations from cowrie.core.config import CowrieConfig from cowrie.shell.command import HoneyPotCommand commands = {} def hardware_platform() -> str: return CowrieConfig.get("shell", "hardware_platform", fallback="x86_64") def kernel_name() -> str: return Co...
5,891
29.848168
86
py
cowrie
cowrie-master/src/cowrie/commands/nohup.py
from __future__ import annotations from cowrie.shell.command import HoneyPotCommand commands = {} class Command_nohup(HoneyPotCommand): def call(self) -> None: if not len(self.args): self.write("nohup: missing operand\n") self.write("Try `nohup --help' for more information.\n")...
769
27.518519
81
py
cowrie
cowrie-master/src/cowrie/commands/uptime.py
from __future__ import annotations import time from cowrie.core import utils from cowrie.shell.command import HoneyPotCommand commands = {} class Command_uptime(HoneyPotCommand): def call(self) -> None: self.write( "{} up {}, 1 user, load average: 0.00, 0.00, 0.00\n".format(time.strftim...
567
23.695652
139
py
cowrie
cowrie-master/src/cowrie/commands/ethtool.py
from __future__ import annotations from cowrie.shell.command import HoneyPotCommand commands = {} class Command_ethtool(HoneyPotCommand): def call(self) -> None: func = self.do_ethtool_help for x in self.args: if x.startswith("lo"): func = self.do_ethtool_lo ...
2,441
28.071429
64
py
cowrie
cowrie-master/src/cowrie/commands/locate.py
from __future__ import annotations import getopt from cowrie.shell.command import HoneyPotCommand commands = {} LOCATE_HELP = """Usage: locate [OPTION]... [PATTERN]... Search for entries in a mlocate database. -A, --all only print entries that match all patterns -b, --basename match only th...
3,912
38.13
105
py
cowrie
cowrie-master/src/cowrie/commands/base64.py
from __future__ import annotations import base64 import getopt import sys from twisted.python import log from cowrie.shell.command import HoneyPotCommand commands = {} class Command_base64(HoneyPotCommand): """ author: Ivan Korolev (@fe7ch) """ mode: str = "e" ignore: bool def start(self)...
4,554
29.57047
91
py
cowrie
cowrie-master/src/cowrie/commands/adduser.py
from __future__ import annotations import random from typing import Optional from twisted.internet import reactor from cowrie.shell.command import HoneyPotCommand commands = {} O_O, O_Q, O_P = 1, 2, 3 class Command_adduser(HoneyPotCommand): item: int output: list[tuple[int, str]] = [ (O_O, "Addi...
3,515
32.169811
115
py
cowrie
cowrie-master/src/cowrie/insults/insults.py
from __future__ import annotations import hashlib import os import time from typing import Any from twisted.conch.insults import insults from twisted.python import log from cowrie.core import ttylog from cowrie.core.config import CowrieConfig from cowrie.shell import protocol class LoggingServerProtocol(insults.S...
8,462
33.125
93
py
cowrie
cowrie-master/src/cowrie/shell/pwd.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
7,069
31.136364
88
py
cowrie
cowrie-master/src/cowrie/shell/avatar.py
from __future__ import annotations from zope.interface import implementer from twisted.conch import avatar from twisted.conch.error import ConchError from twisted.conch.interfaces import IConchUser, ISession, ISFTPServer from twisted.conch.ssh import filetransfer as conchfiletransfer from twisted.conch.ssh.connecti...
2,773
33.675
86
py
cowrie
cowrie-master/src/cowrie/shell/fs.py
# Todo, use os.stat_result, which contains the stat 10-tuple instead of the custom object. from __future__ import annotations import errno import fnmatch import hashlib import os from pathlib import Path import pickle import re import sys import stat import time from typing import Any, Optional from twisted.python ...
21,062
32.014107
104
py
cowrie
cowrie-master/src/cowrie/shell/server.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
3,256
36.011364
85
py
cowrie
cowrie-master/src/cowrie/shell/filetransfer.py
""" This module contains ... """ from __future__ import annotations import os from zope.interface import implementer import twisted import twisted.conch.ls from twisted.conch.interfaces import ISFTPFile, ISFTPServer from twisted.conch.ssh import filetransfer from twisted.conch.ssh.filetransfer import ( FXF_APP...
7,786
31.995763
84
py
cowrie
cowrie-master/src/cowrie/shell/honeypot.py
from __future__ import annotations import copy import os import re import shlex from typing import Any, Optional from twisted.internet import error from twisted.python import failure, log from twisted.python.compat import iterbytes from cowrie.core.config import CowrieConfig from cowrie.shell import fs class Hon...
20,291
35.562162
113
py
cowrie
cowrie-master/src/cowrie/shell/customparser.py
from __future__ import annotations import argparse class OptionNotFound(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class ExitException(Exception): def __init__(self, value): self.value = value def __str__(self): ...
1,605
24.492063
56
py
cowrie
cowrie-master/src/cowrie/shell/command.py
""" This module contains code to run a command """ from __future__ import annotations import os import re import shlex import stat import time from typing import Optional from collections.abc import Callable from twisted.internet import error from twisted.python import failure, log from cowrie.core.config import C...
6,848
32.905941
92
py
cowrie
cowrie-master/src/cowrie/shell/session.py
from __future__ import annotations from zope.interface import implementer from twisted.conch.interfaces import ISession from twisted.conch.ssh import session from twisted.python import log from cowrie.insults import insults from cowrie.shell import protocol @implementer(ISession) class SSHSessionForCowrieUser: ...
3,053
31.83871
81
py
cowrie
cowrie-master/src/cowrie/shell/protocol.py
# -*- test-case-name: cowrie.test.protocol -*- from __future__ import annotations import os import socket import sys import time import traceback from twisted.conch import recvline from twisted.conch.insults import insults from twisted.internet import error from twisted.protocols.policies import TimeoutMixin from tw...
12,602
31.820313
99
py
cowrie
cowrie-master/src/cowrie/ssh/userauth.py
from __future__ import annotations import struct from typing import Any from twisted.conch import error from twisted.conch.interfaces import IConchUser from twisted.conch.ssh import userauth from twisted.conch.ssh.common import NS, getNS from twisted.conch.ssh.transport import DISCONNECT_PROTOCOL_ERROR from twisted...
6,936
36.497297
93
py
cowrie
cowrie-master/src/cowrie/ssh/forwarding.py
""" This module contains code for handling SSH direct-tcpip connection requests """ from __future__ import annotations from twisted.conch.ssh import forwarding from twisted.python import log from cowrie.core.config import CowrieConfig def cowrieOpenConnectForwardingClient(remoteWindow, remoteMaxPacket, data, avat...
6,655
34.404255
111
py
cowrie
cowrie-master/src/cowrie/ssh/keys.py
""" This module contains ... """ from __future__ import annotations import os from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import dsa from cryptography.hazmat.primitives.asymmetric import ec from cryptography.hazmat.primitives.asymmetric import rsa from cry...
4,224
38.12037
83
py
cowrie
cowrie-master/src/cowrie/ssh/connection.py
# All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer in the # doc...
2,731
38.594203
87
py
cowrie
cowrie-master/src/cowrie/ssh/channel.py
""" This module contains a subclass of SSHChannel with additional logging and session size limiting """ from __future__ import annotations import time from twisted.conch.ssh import channel from twisted.python import log from cowrie.core import ttylog from cowrie.core.config import CowrieConfig class CowrieSSHCh...
3,510
29.798246
86
py
cowrie
cowrie-master/src/cowrie/ssh/factory.py
""" This module contains ... """ from __future__ import annotations from configparser import NoOptionError import time from typing import Optional from twisted.conch.openssh_compat import primes from twisted.conch.ssh import factory, keys, transport from twisted.cred import portal as tp from twisted.python import l...
6,876
36.172973
88
py
cowrie
cowrie-master/src/cowrie/ssh/session.py
""" This module contains ... """ from __future__ import annotations from twisted.conch.ssh import session from twisted.conch.ssh.common import getNS from twisted.python import log class HoneyPotSSHSession(session.SSHSession): """ This is an SSH channel that's used for SSH sessions """ def __init_...
2,160
26.705128
80
py
cowrie
cowrie-master/src/cowrie/ssh/transport.py
""" The lowest level SSH protocol. This handles the key negotiation, the encryption and the compression. The transport layer is described in RFC 4253. """ from __future__ import annotations import re import struct import time import uuid import zlib from hashlib import md5 from typing import Any from twisted.conch....
10,587
35.763889
110
py
cowrie
cowrie-master/src/backend_pool/telnet_exec.py
from __future__ import annotations import re from typing import Optional from twisted.conch.telnet import StatefulTelnetProtocol, TelnetTransport from twisted.internet import defer from twisted.internet import reactor from twisted.internet.protocol import ClientFactory from twisted.python import log class TelnetCon...
5,024
32.952703
111
py
cowrie
cowrie-master/src/backend_pool/nat.py
from __future__ import annotations from threading import Lock from twisted.internet import protocol from twisted.internet import reactor class ClientProtocol(protocol.Protocol): def dataReceived(self, data: bytes) -> None: self.server_protocol.transport.write(data) # type: ignore def connectionLost...
4,059
31.48
111
py
cowrie
cowrie-master/src/backend_pool/ssh_exec.py
from __future__ import annotations from twisted.conch.ssh import channel, common, connection, transport, userauth from twisted.internet import defer, protocol from twisted.internet import reactor class PasswordAuth(userauth.SSHUserAuthClient): def __init__(self, user, password, conn): super().__init__(us...
3,114
28.666667
88
py