repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
cowrie | cowrie-master/src/cowrie/test/__init__.py | 0 | 0 | 0 | py | |
cowrie | cowrie-master/src/cowrie/test/test_chmod.py | # Copyright (c) 2020 Peter Sufliarsky
# See LICENSE for details.
from __future__ import annotations
import os
import unittest
from cowrie.shell.protocol import HoneyPotInteractiveProtocol
from cowrie.test.fake_server import FakeAvatar, FakeServer
from cowrie.test.fake_transport import FakeTransport
os.environ["COWRI... | 3,935 | 32.07563 | 86 | py |
cowrie | cowrie-master/src/cowrie/test/test_base_commands.py | # Copyright (c) 2016 Dave Germiquet
# See LICENSE for details.
from __future__ import annotations
import os
import unittest
from cowrie.commands.base import Command_php
from cowrie.shell.protocol import HoneyPotInteractiveProtocol
from cowrie.test.fake_server import FakeAvatar, FakeServer
from cowrie.test.fake_transp... | 12,069 | 35.029851 | 153 | py |
cowrie | cowrie-master/src/cowrie/test/test_awk.py | # Copyright (c) 2018 Michel Oosterhof
# See LICENSE for details.
from __future__ import annotations
import os
import unittest
from cowrie.shell.protocol import HoneyPotInteractiveProtocol
from cowrie.test.fake_server import FakeAvatar, FakeServer
from cowrie.test.fake_transport import FakeTransport
os.environ["COWRI... | 1,895 | 33.472727 | 78 | py |
cowrie | cowrie-master/src/cowrie/test/test_utils.py | from __future__ import annotations
import configparser
import unittest
from io import StringIO
from cowrie.core.utils import (
create_endpoint_services,
durationHuman,
get_endpoints_from_section,
)
from twisted.application.service import MultiService
from twisted.internet import protocol
from twisted.int... | 2,934 | 30.55914 | 88 | py |
cowrie | cowrie-master/src/cowrie/test/test_proxy.py | # -*- test-case-name: Cowrie Proxy Test Cases -*-
# Copyright (c) 2019 Guilherme Borges
# See LICENSE for details.
from __future__ import annotations
import os
import unittest
from cowrie.core.checkers import HoneypotPasswordChecker, HoneypotPublicKeyChecker
from cowrie.core.realm import HoneyPotRealm
from cowrie.s... | 3,706 | 33.971698 | 115 | py |
cowrie | cowrie-master/src/cowrie/test/test_tee.py | # Copyright (c) 2018 Michel Oosterhof
# See LICENSE for details.
from __future__ import annotations
import os
import unittest
from cowrie.shell.protocol import HoneyPotInteractiveProtocol
from cowrie.test.fake_server import FakeAvatar, FakeServer
from cowrie.test.fake_transport import FakeTransport
os.environ["COWRI... | 2,094 | 31.734375 | 88 | py |
cowrie | cowrie-master/src/cowrie/pool_interface/client.py | # Copyright (c) 2019 Guilherme Borges <guilhermerosasborges@gmail.com>
# See the COPYRIGHT file for more information
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 PoolC... | 3,888 | 29.622047 | 89 | py |
cowrie | cowrie-master/src/cowrie/pool_interface/__init__.py | 0 | 0 | 0 | py | |
cowrie | cowrie-master/src/cowrie/pool_interface/handler.py | # Copyright (c) 2019 Guilherme Borges <guilhermerosasborges@gmail.com>
# See the COPYRIGHT file for more information
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.c... | 2,547 | 33.432432 | 118 | py |
cowrie | cowrie-master/src/cowrie/ssh_proxy/userauth.py | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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 ProxySSHAuthSe... | 1,168 | 29.763158 | 81 | py |
cowrie | cowrie-master/src/cowrie/ssh_proxy/server_transport.py | # Copyright (c) 2016 Thomas Nicholson <tnnich@googlemail.com>, 2019 Guilherme Borges <guilhermerosasborges@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of so... | 17,117 | 38.442396 | 117 | py |
cowrie | cowrie-master/src/cowrie/ssh_proxy/client_transport.py | # Copyright (c) 2019 Guilherme Borges <guilhermerosasborges@gmail.com>
# 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 l... | 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/__init__.py | 0 | 0 | 0 | py | |
cowrie | cowrie-master/src/cowrie/ssh_proxy/protocols/sftp.py | # Copyright (c) 2016 Thomas Nicholson <tnnich@googlemail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, t... | 13,833 | 39.332362 | 119 | py |
cowrie | cowrie-master/src/cowrie/ssh_proxy/protocols/base_protocol.py | # Copyright (c) 2016 Thomas Nicholson <tnnich@googlemail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, t... | 3,127 | 33.755556 | 105 | py |
cowrie | cowrie-master/src/cowrie/ssh_proxy/protocols/exec_term.py | # Copyright (c) 2016 Thomas Nicholson <tnnich@googlemail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, t... | 4,025 | 37.342857 | 81 | py |
cowrie | cowrie-master/src/cowrie/ssh_proxy/protocols/ssh.py | # Copyright (c) 2016 Thomas Nicholson <tnnich@googlemail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, t... | 16,858 | 39.820823 | 120 | py |
cowrie | cowrie-master/src/cowrie/ssh_proxy/protocols/term.py | # Copyright (c) 2016 Thomas Nicholson <tnnich@googlemail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, t... | 9,070 | 38.960352 | 88 | py |
cowrie | cowrie-master/src/cowrie/ssh_proxy/protocols/__init__.py | 0 | 0 | 0 | py | |
cowrie | cowrie-master/src/cowrie/ssh_proxy/protocols/port_forward.py | # Copyright (c) 2016 Thomas Nicholson <tnnich@googlemail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, t... | 1,927 | 43.837209 | 91 | py |
cowrie | cowrie-master/src/cowrie/commands/wc.py | # Copyright (c) 2019 Nuno Novais <nuno@noais.me>
# 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 C... | 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 | # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
# coding=utf-8
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.interne... | 41,589 | 34.486348 | 188 | py |
cowrie | cowrie-master/src/cowrie/commands/chpasswd.py | # Copyright (c) 2019 Nuno Novais <nuno@noais.me>
# 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 Comm... | 3,241 | 30.475728 | 99 | py |
cowrie | cowrie-master/src/cowrie/commands/which.py | # Copyright (c) 2013 Bas Stottelaar <basstottelaar [AT] gmail [DOT] com>
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 u... | 806 | 23.454545 | 72 | py |
cowrie | cowrie-master/src/cowrie/commands/sleep.py | # Copyright (c) 2015 Michel Oosterhof <michel@oosterhof.net>
# 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)... | 1,038 | 21.586957 | 98 | py |
cowrie | cowrie-master/src/cowrie/commands/scp.py | # Copyright (c) 2015 Michel Oosterhof <michel@oosterhof.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, th... | 7,501 | 32.641256 | 88 | py |
cowrie | cowrie-master/src/cowrie/commands/free.py | # Copyright (c) 2015 Michel Oosterhof <michel@oosterhof.net>
# 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 share... | 3,550 | 29.878261 | 118 | py |
cowrie | cowrie-master/src/cowrie/commands/yum.py | # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
# Modified by Fabiola Buschendorf, https://github.com/FabiolaBusch
from __future__ import annotations
import hashlib
import random
import re
from typing import Any, Optional
from collections.abc import Callable
fr... | 12,980 | 38.099398 | 120 | py |
cowrie | cowrie-master/src/cowrie/commands/curl.py | # Copyright (c) 2022 Michel Oosterhof <michel@oosterhof.net>
# See the COPYRIGHT file for more information
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.a... | 18,683 | 41.367347 | 128 | py |
cowrie | cowrie-master/src/cowrie/commands/iptables.py | # Copyright (c) 2013 Bas Stottelaar <basstottelaar [AT] gmail [DOT] com>
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:
sel... | 16,309 | 32.150407 | 114 | py |
cowrie | cowrie-master/src/cowrie/commands/ftpget.py | # Author: Claud Xiao
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
comman... | 9,880 | 29.781931 | 87 | py |
cowrie | cowrie-master/src/cowrie/commands/perl.py | # Copyright (c) 2015 Michel Oosterhof <michel@oosterhof.net>
# 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):
... | 5,032 | 38.629921 | 101 | py |
cowrie | cowrie-master/src/cowrie/commands/fs.py | # Copyright (c) 2010 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
"""
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 impor... | 20,701 | 30.947531 | 90 | py |
cowrie | cowrie-master/src/cowrie/commands/apt.py | # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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 inlineC... | 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 | # Copyright (c) 2020 Peter Sufliarsky <sufliarskyp@gmail.com>
# See the COPYRIGHT file for more information
"""
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]]
... | 3,069 | 33.494382 | 77 | py |
cowrie | cowrie-master/src/cowrie/commands/awk.py | # Copyright (c) 2010 Michel Oosterhof <michel@oosterhof.net>
# See the COPYRIGHT file for more information
# 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 Matc... | 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/gcc.py | # Copyright (c) 2013 Bas Stottelaar <basstottelaar [AT] gmail [DOT] com>
from __future__ import annotations
import getopt
import os
import random
import re
import time
from twisted.internet import reactor
from twisted.internet.defer import Deferred
from cowrie.core.config import CowrieConfig
from cowrie.shell.comma... | 13,678 | 42.15142 | 635 | py |
cowrie | cowrie-master/src/cowrie/commands/ulimit.py | # Copyright (c) 2015 Michel Oosterhof <michel@oosterhof.net>
# 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 [-SHacdf... | 1,100 | 21.9375 | 78 | py |
cowrie | cowrie-master/src/cowrie/commands/ls.py | # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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
command... | 6,339 | 30.7 | 87 | py |
cowrie | cowrie-master/src/cowrie/commands/python.py | # Copyright (c) 2015 Michel Oosterhof <michel@oosterhof.net>
# All rights reserved.
"""
This module contains the python commnad
"""
from __future__ import annotations
import getopt
from twisted.python import log
from cowrie.shell.command import HoneyPotCommand
commands = {}
class Command_python(HoneyPotCommand)... | 5,833 | 41.583942 | 94 | py |
cowrie | cowrie-master/src/cowrie/commands/cat.py | # Copyright (c) 2010 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
"""
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 FileNotF... | 4,155 | 28.062937 | 95 | py |
cowrie | cowrie-master/src/cowrie/commands/ping.py | # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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
com... | 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 | # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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 cowr... | 4,706 | 29.367742 | 88 | py |
cowrie | cowrie-master/src/cowrie/commands/tar.py | # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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(H... | 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 | # Copyright (c) 2019 Nuno Novais <nuno@noais.me>
# 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 Comma... | 2,134 | 26.025316 | 75 | py |
cowrie | cowrie-master/src/cowrie/commands/chmod.py | # Copyright (c) 2020 Peter Sufliarsky <sufliarskyp@gmail.com>
# See the COPYRIGHT file for more information
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]... | 5,277 | 35.150685 | 96 | py |
cowrie | cowrie-master/src/cowrie/commands/service.py | # Copyright (c) 2015 Michel Oosterhof <michel@oosterhof.net>
# 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 Papai... | 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 | # Copyright (c) 2020 Julius ter Pelkwijk <pelkwijk@gmail.com>
# Based on code made by Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
from __future__ import annotations
import os
import zipfile
from twisted.python import log
from cowrie.shell.command import HoneyPotCommand
from cowri... | 5,357 | 44.02521 | 99 | py |
cowrie | cowrie-master/src/cowrie/commands/wget.py | # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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... | 11,157 | 30.971347 | 128 | py |
cowrie | cowrie-master/src/cowrie/commands/tee.py | # Copyright (c) 2020 Matej Dujava <mdujava@kocurkovo.cz>
# See the COPYRIGHT file for more information
"""
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 impo... | 4,597 | 28.474359 | 95 | py |
cowrie | cowrie-master/src/cowrie/commands/last.py | # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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)
... | 1,299 | 24.490196 | 81 | py |
cowrie | cowrie-master/src/cowrie/commands/du.py | # Copyright (c) 2018 Danilo Vargas <danilo.vargas@csiete.org>
# See the COPYRIGHT file for more information
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) -... | 6,062 | 44.931818 | 80 | py |
cowrie | cowrie-master/src/cowrie/commands/__init__.py | # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
from __future__ import annotations
__all__ = [
"adduser",
"apt",
"awk",
"base",
"base64",
"busybox",
"cat",
"chmod",
"chpasswd",
"crontab",
"curl",
"dd",
"du",
"... | 770 | 12.526316 | 54 | py |
cowrie | cowrie-master/src/cowrie/commands/dd.py | # Copyright (c) 2016 Michel Oosterhof <michel@oosterhof.net>
# See the COPYRIGHT file for more information
"""
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... | 4,279 | 28.517241 | 84 | py |
cowrie | cowrie-master/src/cowrie/commands/uname.py | # Copyright (c) 2010 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
"""
uname command
"""
from __future__ import annotations
from cowrie.core.config import CowrieConfig
from cowrie.shell.command import HoneyPotCommand
commands = {}
def hardware_platform() -> str:
return Cowrie... | 5,891 | 29.848168 | 86 | py |
cowrie | cowrie-master/src/cowrie/commands/nohup.py | # Copyright (c) 2014 Peter Reuterås <peter@reuteras.com>
# See the COPYRIGHT file for more information
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... | 769 | 27.518519 | 81 | py |
cowrie | cowrie-master/src/cowrie/commands/env.py | from __future__ import annotations
from cowrie.shell.command import HoneyPotCommand
commands = {}
"""
env: invalid option -- 'h'
Try `env --help' for more information.
Usage: env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]
Set each NAME to VALUE in the environment and run COMMAND.
-i, --ignore-environment ... | 1,238 | 32.486486 | 90 | py |
cowrie | cowrie-master/src/cowrie/commands/uptime.py | # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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:
... | 567 | 23.695652 | 139 | py |
cowrie | cowrie-master/src/cowrie/commands/ethtool.py | # Copyright (c) 2014 Peter Reuterås <peter@reuteras.com>
# See the COPYRIGHT file for more information
from __future__ import annotations
from cowrie.shell.command import HoneyPotCommand
commands = {}
class Command_ethtool(HoneyPotCommand):
def call(self) -> None:
func = self.do_ethtool_help
fo... | 2,441 | 28.071429 | 64 | py |
cowrie | cowrie-master/src/cowrie/commands/ifconfig.py | # Copyright (c) 2014 Peter Reuterås <peter@reuteras.com>
# See the COPYRIGHT file for more information
from __future__ import annotations
from random import randint, randrange
from cowrie.shell.command import HoneyPotCommand
HWaddr = "{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}".format(
randint(0, 255),
randi... | 2,965 | 29.895833 | 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 | # Copyright (c) 2010 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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 Comm... | 3,515 | 32.169811 | 115 | py |
cowrie | cowrie-master/src/cowrie/insults/insults.py | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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... | 8,462 | 33.125 | 93 | py |
cowrie | cowrie-master/src/cowrie/insults/__init__.py | 0 | 0 | 0 | py | |
cowrie | cowrie-master/src/cowrie/shell/pwd.py | # Copyright (c) 2015 Michel Oosterhof <michel@oosterhof.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, th... | 7,069 | 31.136364 | 88 | py |
cowrie | cowrie-master/src/cowrie/shell/avatar.py | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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, I... | 2,773 | 33.675 | 86 | py |
cowrie | cowrie-master/src/cowrie/shell/fs.py | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
# 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 ... | 21,062 | 32.014107 | 104 | py |
cowrie | cowrie-master/src/cowrie/shell/server.py | # Copyright (c) 2015 Michel Oosterhof <michel@oosterhof.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, th... | 3,256 | 36.011364 | 85 | py |
cowrie | cowrie-master/src/cowrie/shell/filetransfer.py | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
"""
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, ISFTP... | 7,786 | 31.995763 | 84 | py |
cowrie | cowrie-master/src/cowrie/shell/honeypot.py | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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.co... | 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 | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
"""
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
fr... | 6,848 | 32.905941 | 92 | py |
cowrie | cowrie-master/src/cowrie/shell/session.py | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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 i... | 3,053 | 31.83871 | 81 | py |
cowrie | cowrie-master/src/cowrie/shell/protocol.py | # -*- test-case-name: cowrie.test.protocol -*-
# Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
from __future__ import annotations
import os
import socket
import sys
import time
import traceback
from twisted.conch import recvline
from twisted.conch.insults imp... | 12,602 | 31.820313 | 99 | py |
cowrie | cowrie-master/src/cowrie/shell/__init__.py | 0 | 0 | 0 | py | |
cowrie | cowrie-master/src/cowrie/ssh/userauth.py | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
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.... | 6,936 | 36.497297 | 93 | py |
cowrie | cowrie-master/src/cowrie/ssh/forwarding.py | # Copyright (c) 2009-2014 Michel Oosterhof <michel@oosterhof.net>
# See the COPYRIGHT file for more information
"""
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.c... | 6,655 | 34.404255 | 111 | py |
cowrie | cowrie-master/src/cowrie/ssh/keys.py | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
"""
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... | 4,224 | 38.12037 | 83 | py |
cowrie | cowrie-master/src/cowrie/ssh/connection.py | # Copyright (c) 2015 Michel Oosterhof <michel@oosterhof.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, th... | 2,731 | 38.594203 | 87 | py |
cowrie | cowrie-master/src/cowrie/ssh/channel.py | # Copyright (c) 2017 Michel Oosterhof <michel@oosterhof.net>
# See the COPYRIGHT file for more information
"""
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... | 3,510 | 29.798246 | 86 | py |
cowrie | cowrie-master/src/cowrie/ssh/factory.py | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
"""
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.co... | 6,876 | 36.172973 | 88 | py |
cowrie | cowrie-master/src/cowrie/ssh/session.py | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
"""
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(ses... | 2,160 | 26.705128 | 80 | py |
cowrie | cowrie-master/src/cowrie/ssh/__init__.py | 0 | 0 | 0 | py | |
cowrie | cowrie-master/src/cowrie/ssh/transport.py | # Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
"""
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 stru... | 10,587 | 35.763889 | 110 | py |
cowrie | cowrie-master/src/backend_pool/telnet_exec.py | # Based on https://github.com/fjogstad/twisted-telnet-client
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 C... | 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 |
cowrie | cowrie-master/src/backend_pool/util.py | # Copyright (c) 2019 Guilherme Borges <guilhermerosasborges@gmail.com>
# See the COPYRIGHT file for more information
from __future__ import annotations
from typing import Optional
import os
import random
import subprocess
import time
def ping(guest_ip: str) -> int:
# could use `capture_output=True` instead of ... | 2,150 | 25.555556 | 113 | py |
cowrie | cowrie-master/src/backend_pool/pool_service.py | # Copyright (c) 2019 Guilherme Borges <guilhermerosasborges@gmail.com>
# See the COPYRIGHT file for more information
from __future__ import annotations
import os
import time
from threading import Lock
from twisted.internet import reactor
from twisted.internet import threads
from twisted.python import log
import back... | 15,552 | 34.187783 | 120 | py |
cowrie | cowrie-master/src/backend_pool/pool_server.py | # Copyright (c) 2019 Guilherme Borges <guilhermerosasborges@gmail.com>
# See the COPYRIGHT file for more information
from __future__ import annotations
import struct
from twisted.internet.protocol import Factory, Protocol
from twisted.python import log
from backend_pool.nat import NATService
from backend_pool.pool_... | 7,000 | 33.658416 | 92 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.