Skip to content

Instantly share code, notes, and snippets.

View ativarsoft's full-sized avatar

Mateus de Lima Oliveira ativarsoft

View GitHub Profile
@ativarsoft
ativarsoft / apt-mateus1.diff
Created September 4, 2023 23:44
Prevent fake malicious debian packages created by cryptocurrency miners from being installed.
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc
index 80b9bbf3f..ac0ec5286 100644
--- a/apt-pkg/contrib/hashes.cc
+++ b/apt-pkg/contrib/hashes.cc
@@ -135,6 +135,30 @@ std::string HashString::GetHashForFile(std::string filename) const /*{{{*/
Hashes SHA512(Hashes::SHA512SUM);
SHA512.AddFD(Fd);
fileHash = SHA512.GetHashString(Hashes::SHA512SUM).Hash;
+ } else if (strcasecmp(Type.c_str(), "All") == 0) {
+ fileHash = "";
@ativarsoft
ativarsoft / apache-errors.sh
Created February 10, 2023 18:22
Web server utility scripts
#!/bin/bash
sudo cat /var/log/apache2/error.log
@ativarsoft
ativarsoft / clear-opcache.sh
Created February 10, 2023 18:13
Clear PHP opcache
#!/bin/bash -e
sudo service apache2 stop
sudo service php7.4-fpm stop
sudo rm -fr /var/mateus/opcache/*
sudo service php7.4-fpm start
sudo service apache2 start
@ativarsoft
ativarsoft / extract-rsa-from-certificate.sh
Created February 10, 2023 18:07
Extract RSA public key from letsencrypt certificate and print it on the terminal as ASCII armor
#!/bin/bash
CERT=/etc/letsencrypt/live/ativarsoft.com.br/fullchain.pem
openssl x509 -pubkey -noout -in $CERT