Changing throttle rate to 5 requests/sec over 2 minutes.

This commit is contained in:
sigonasr2 2025-04-21 17:56:08 -05:00
parent 21fdefe80d
commit 40e6f7b973
3 changed files with 7 additions and 6 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
/GiteaBlocker/x64/Debug
/GiteaBlocker/GiteaBlocker.vcxproj.user
/GiteaBlocker/GiteaBlocker.vcxproj.filters
/GiteaBlocker/GiteaBlocker/x64/Debug

View File

@ -4,5 +4,5 @@
#Config File Parameters:
# 1st Line: (Default 5000) Number of log entries to read
# 2nd Line: (Default 5) Number of seconds max the number of accesses can reach.
# 3rd Line: (Default 10) Number of accesses that are reached in number of seconds before the user is considered banned.
# 2nd Line: (Default 120) Number of seconds max the number of accesses can reach.
# 3rd Line: (Default 600) Number of accesses that are reached in number of seconds before the user is considered banned.

View File

@ -20,13 +20,13 @@ struct User{
int main(){
while(true){
uint32_t logEntries{5000};
uint32_t secondsSeparationOfAccess{5}; //In X seconds, the number of entries cannot be reached.
uint32_t tooFrequentAccess{10}; //Number of entries required in the seconds range specified to consider things spam.
uint32_t secondsSeparationOfAccess{120}; //In X seconds, the number of entries cannot be reached.
uint32_t tooFrequentAccess{600}; //Number of entries required in the seconds range specified to consider things spam.
std::unordered_map<std::string,User>userData;
std::unordered_set<std::string>ipBanList;
std::cout<<"Reading config file..."<<std::endl;
std::ifstream config{"~/.giteablocker-config"};
std::ifstream config{"/home/sigonasr2/.giteablocker-config"};
if(!config.good()){
std::cout<<"No config file found, using defaults."<<std::endl;
}else{
@ -45,7 +45,7 @@ int main(){
std::cout<<"Reading journal..."<<std::endl;
std::system(std::format("journalctl -n {} -u gitea > /home/sigonasr2/gitea.access",logEntries).c_str());
std::cout<<"Beginning parsing..."<<std::endl;
std::ifstream file{"/home/sigonasr2/gitea.access"};
std::ifstream file{"C:/Users/sigon/OneDrive/Documents/gitea.access"};
while(!file.eof()){
std::string line{};
std::getline(file,line);