Last active
November 19, 2024 07:52
-
-
Save theSoberSobber/844a4263a3ebc5cf8960ae12384aab90 to your computer and use it in GitHub Desktop.
current ip of my home server, with a max lag of 60 seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"ip": "116.72.194.187"} |
Author
theSoberSobber
commented
Mar 28, 2024
crontab -e
* * * * * /home/meso/.pyenv/shims/python /home/meso/Desktop/monitor/main.py >> /home/meso/Desktop/monitor/logs 2>&1
use pyenv and nvm.
2 screen, cam-enum and alertbot.
Scp Script
Remember to specify username and port number in the below script
# Check if the correct number of arguments is provided
if ($args.Count -ne 3) {
Write-Host "Usage: ./copy.ps1 (from|to) <source_path> <destination_path>"
Exit
}
# Function to copy file using SCP
function Copy-FileUsingSCP {
param(
[string]$fromOrTo,
[string]$sourcePath,
[string]$destinationPath
)
# Fetch server JSON from GitHub Gist
$myJson = curl "https://api.github.com/gists/844a4263a3ebc5cf8960ae12384aab90" | ConvertFrom-Json
$newJson = $myJson.files."server.json".content | ConvertFrom-Json
$myIp = $newJson.ip
$username = "username"
$port = port
# Determine SCP source and destination paths based on 'from' or 'to'
if ($fromOrTo -eq "from") {
$scpSource = "$username@$myIp`:$sourcePath" # Enclosing $sourcePath in double quotes
$scpDestination = $destinationPath
} elseif ($fromOrTo -eq "to") {
$scpSource = $sourcePath
$scpDestination = "$username@$myIp`:$destinationPath" # Enclosing $destinationPath in double quotes
} else {
Write-Host "Invalid option. Use 'from' or 'to'."
Exit
}
# Output SCP operation details
Write-Host "Copying $scpSource to $scpDestination"
# Perform SCP operation
scp -P $port $scpSource $scpDestination
}
# Determine if 'from' or 'to' option is chosen
$option = $args[0]
$sourcePath = $args[1]
$destinationPath = $args[2]
# Copy file using SCP based on chosen option
if ($option -eq "from") {
Copy-FileUsingSCP "from" $sourcePath $destinationPath
} elseif ($option -eq "to") {
Copy-FileUsingSCP "to" $sourcePath $destinationPath
} else {
Write-Host "Invalid option. Use 'from' or 'to'."
Exit
}
Public Key
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICOpceinYc2WeKwPFWvU79fySvR0NXi5mSKj51ZJ712r [email protected]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment