This file contains hidden or 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
| # Base post example taken from here https://www.jokecamp.com/blog/invoke-restmethod-powershell-examples/ | |
| function Send-DiscordNotif($text, $webhook) { | |
| $json = @{ | |
| content=$text | |
| } | |
| $body = $json | ConvertTo-Json | |
| $response = Invoke-RestMethod -Method Post -Uri $webhook -Body $body -ContentType 'application/json' | |
| $response | |
| } |
This file contains hidden or 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
| # You'll need to run ($sudo crontab -e) | |
| # since the script needs root permisions to modify and create the current_users at /var | |
| 0 * * * * /home/kevin/md5.sh |
This file contains hidden or 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
| #!/bin/bash | |
| if [ -e /var/log/current_users ] | |
| then | |
| #TODO check last MD5 | |
| echo "Last MD5 found" | |
| lastHash=$( awk 'NR==1{print $1; exit}' /var/log/current_users ) #Use awk to take only the hash at the top of the file | |
| newHash=$( awk -F : '{print $1":"$6}' /etc/passwd | md5sum | awk '{print $1}' ) #Check the processed passwd file to gather the current MD5 print | |
| echo 'Last: '$lastHash 'New: '$newHash | |
| if [ $lastHash = $newHash ] |
This file contains hidden or 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
| #include <ESP8266WiFi.h> | |
| #include <ESP8266WebServer.h> | |
| const char* ssid = ".............."; | |
| const char* password = "................"; | |
| String form = "<form action='led'><input type='radio' name='state' value='1' checked>On<input type='radio' name='state' value='0'>Off<input type='submit' value='Submit'></form>"; | |
| String imagepage = "<img src='/led.png'>"; |