min_working

This commit is contained in:
Samuel
2024-07-11 19:12:59 +01:00
parent 165b66f1f9
commit 884849b2c2
13 changed files with 171 additions and 62 deletions

View File

@@ -1,4 +0,0 @@
Get-WindowsCapability -Online | ? Name -like sshd*
Get-WindowsCapability -Online | ? Name -like ssh-agent*
Remove-NetFirewallRule -Name "sshd"

View File

15
tools/build.ps1 Normal file
View File

@@ -0,0 +1,15 @@
# CLEAN
./tools/clean.ps1
# pyarmor gen -O dist -i src --recursive
# cython
# pyinstaller --onefile -I "NONE" -add-data "data;data" ./src/main.py
(pyinstaller --clean --distpath ./dist --workpath ./build main.spec) -and (pyinstaller .\main.spec)
# upx
# RUN.................................................................................................
./dist/main.exe
./tools/test.ps1

8
tools/clean.ps1 Normal file
View File

@@ -0,0 +1,8 @@
# Delete Port 22 Firewall Rule
Remove-NetFirewallRule -Name "sshd"
# Uninstall SSH Server
Stop-Service -Name sshd
Remove-WindowsCapability -Online -Name "OpenSSH.Server~~~~0.0.1.0"
ssh-add -D # delete existing identities
del -R $env:ProgramData\ssh\
del $env:USERPROFILE\.ssh\known_hosts

View File

@@ -1,17 +0,0 @@
mkdir .\data
mkdir .\data\local_keys
mkdir .\data\remote_keys
del ./data/remote_keys/administrator_authorized_keys
del ./data/local_keys/*
del ./data/remote_keys/*
for ($i=0; $i -lt 10; $i++){
ssh-keygen -f ./data/local_keys/id_ecdsa_$i -t ecdsa -b 256 -q -N "''" -C "local_key"
(Get-Content -Raw -Encoding Default "./data/remote_keys/id_ecdsa_$i") -replace "`r`n", "`n" | Set-Content -NoNewline -Encoding UTF8 "./data/remote_keys/id_ecdsa_$i"
(Get-Content -Raw -Encoding Default "./data/remote_keys/id_ecdsa_$i.pub") -replace "`r`n", "`n" | Set-Content -NoNewline -Encoding UTF8 "./data/remote_keys/id_ecdsa_$i.pub"
ssh-keygen -f ./data/remote_keys/id_ecdsa_$i -t ecdsa -b 256 -q -N "''" -C "remote_key"
(Get-Content -Raw -Encoding Default "./data/local_keys/id_ecdsa_$i") -replace "`r`n", "`n" | Set-Content -NoNewline -Encoding UTF8 "./data/local_keys/id_ecdsa_$i"
(Get-Content -Raw -Encoding Default "./data/local_keys/id_ecdsa_$i.pub") -replace "`r`n", "`n" | Set-Content -NoNewline -Encoding UTF8 "./data/local_keys/id_ecdsa_$i.pub"
cat ./data/remote_keys/id_ecdsa_$i.pub >> ./data/remote_keys/administrator_authorized_keys
(Get-Content -Raw -Encoding Default "./data/remote_keys/administrator_authorized_keys") -replace "`r`n", "`n" | Set-Content -NoNewline -Encoding UTF8 "./data/remote_keys/administrator_authorized_keys"
del ./data/remote_keys/*.pub
}

10
tools/make_ssh_keys.ps1 Normal file
View File

@@ -0,0 +1,10 @@
del -r .\data\local_keys
del -r .\data\remote_keys
mkdir -p .\data\local_keys
mkdir -p .\data\remote_keys
for ($i=0; $i -lt 4; $i++){
ssh-keygen -f ./data/local_keys/id_ecdsa_$i -t ecdsa -b 256 -q -N '""' -C "local_key_$i"
ssh-keygen -f ./data/remote_keys/id_ecdsa_$i -t ecdsa -b 256 -q -N '""' -C "remote_key_$i"
cat ./data/remote_keys/id_ecdsa_$i.pub >> ./data/remote_keys/administrator_authorized_keys
# del ./data/remote_keys/*.pub
}

10
tools/test.ps1 Normal file
View File

@@ -0,0 +1,10 @@
# Test
Get-Service -Name sshd
Get-Service -Name ssh-agent
Get-WindowsCapability -Online | ? Name -like OpenSSH.Client*
Get-WindowsCapability -Online | ? Name -like OpenSSH.Server*
ssh-add -l
cat C:\ProgramData\ssh\administrators_authorized_keys
cat C:\ProgramData\ssh\client_config
cat C:\ProgramData\ssh\sshd_config
ssh localhost