Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
update project dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
esoadamo committed Jun 30, 2019
1 parent 4b28c6f commit a83516d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Binary file modified blocker
100644 → 100755
Binary file not shown.
10 changes: 5 additions & 5 deletions blocker.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define iptables /sbin/iptables
#define ipset /sbin/ipset
#define username "simpleguardian"
#define indexCommand 1
#define indexCommand 1
#define indexIp 2

/**
Expand Down Expand Up @@ -65,7 +65,7 @@ int is_already_blocked(char **argv) {
Returns 0 if not blocked, 1 if already blocked
*/
char command_check_if_blocked[] = "ipset test simpleguardian %s > /dev/null 2>&1";
char *command_check_if_blocked_formatted = (char*)malloc(sizeof(command_check_if_blocked) + sizeof(argv[indexIp]));
char *command_check_if_blocked_formatted = (char*)malloc(50 + sizeof(command_check_if_blocked) + sizeof(argv[indexIp]));
sprintf(command_check_if_blocked_formatted, command_check_if_blocked, argv[indexIp]);
return system(command_check_if_blocked_formatted) == 0;
}
Expand Down Expand Up @@ -107,7 +107,7 @@ int main(int argc, char **argv){

printf("blocking %s\n", argv[indexIp]);
char command[] = "ipset add simpleguardian %s > /dev/null 2>&1";
char *command_formatted = (char*)malloc(sizeof(command) + sizeof(argv[indexIp]));
char *command_formatted = (char*)malloc(50 + sizeof(command) + sizeof(argv[indexIp]));
sprintf(command_formatted, command, argv[indexIp]);

system(command_formatted);
Expand All @@ -122,12 +122,12 @@ int main(int argc, char **argv){
printf("unblocking %s\n", argv[indexIp]);

char command[] = "ipset del simpleguardian %s > /dev/null 2>&1";
char *command_formatted = (char*)malloc(sizeof(command) + sizeof(argv[indexIp]));
char *command_formatted = (char*)malloc(50 + sizeof(command) + sizeof(argv[indexIp]));
sprintf(command_formatted, command, argv[indexIp]);

system(command_formatted);

exit(0);
}
help(1);
}
}
2 changes: 1 addition & 1 deletion build-deb.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
Essential: no
Section: security
Priority: optional
Depends: python3, systemd, python3-pip, python3-venv
Depends: python3, systemd, python3-pip, python3-venv, iptables, ipset
Maintainer: Adam Hlaváček
Installed-Size: %d
Description: Protection against brute force attacks
Expand Down
2 changes: 1 addition & 1 deletion simple-guardian.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ def load_config(dict_src=None, dict_target=None): # type: (dict, dict) -> None
:return: None
"""
if dict_src is None:
with open('config.json', 'r') as f:
with open('data/config.json', 'r') as f:
dict_src = json.load(f)
dict_target = CONFIG
for k, v in dict_src.items():
Expand Down

0 comments on commit a83516d

Please sign in to comment.