Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IsADirectoryError: [Errno 21] Is a directory: '/tmp/tmpqouh7cck/.git/objects/pack' #27

Open
ghost opened this issue Nov 15, 2022 · 2 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Nov 15, 2022

I passed this command.
githacker --url 'https://www.example.com/.git' --threads 3 --output-folder res

The script is running well. But after some time this error came

Traceback (most recent call last):

  File "/usr/local/bin/githacker", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/GitHacker/__init__.py", line 482, in main
    ).start()
  File "/usr/local/lib/python3.10/dist-packages/GitHacker/__init__.py", line 90, in start
    return self.sighted()
  File "/usr/local/lib/python3.10/dist-packages/GitHacker/__init__.py", line 110, in sighted
    return self.git_clone()
  File "/usr/local/lib/python3.10/dist-packages/GitHacker/__init__.py", line 226, in git_clone
    self.copy_useful_files()
  File "/usr/local/lib/python3.10/dist-packages/GitHacker/__init__.py", line 199, in copy_useful_files
    shutil.copy(src, dst)
  File "/usr/lib/python3.10/shutil.py", line 417, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.10/shutil.py", line 254, in copyfile
    with open(src, 'rb') as fsrc:
IsADirectoryError: [Errno 21] Is a directory: '/tmp/tmpqouh7cck/.git/objects/pack'
@WangYihang WangYihang self-assigned this Feb 21, 2023
@WangYihang WangYihang added the bug label Feb 21, 2023
@glslowhand
Copy link

glslowhand commented Jun 24, 2023

同上问题,其实完整文件已经下载到
IsADirectoryError: [Errno 21] Is a directory: '/tmp/tmpqouh7cck/.git/objects/pack'
上面这条错误语句中给出的/tmp/tmpqouh7cck/(不同用户文件名不同,但都在/tmp中)中
而且,我在卡面的执行中也出现了许多的报错,但最后在/tmp的文件中可以正常使用

┌──(root㉿kali)-[~]
└─# githacker --url http://127.0.0.1/git_test/.git/ --output-folder result

2023-06-24 06:44:52 INFO 1 urls to be exploited
2023-06-24 06:44:52 INFO Exploiting http://127.0.0.1/git_test/.git/ into result/fc518884ff3e37dfdb43722a40c9bdc9
2023-06-24 06:44:52 INFO Directory listing enable under: apache
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [3101 bytes] 200 .git/?C=M;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [3101 bytes] 200 .git/?C=S;O=A
2023-06-24 06:44:52 ERROR [3101 bytes] 200 .git/?C=N;O=D
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 INFO [23 bytes] 200 .git/HEAD
2023-06-24 06:44:52 INFO [9 bytes] 200 .git/COMMIT_EDITMSG
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [784 bytes] 200 .git/branches/?C=N;O=D
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [784 bytes] 200 .git/branches/?C=M;O=A
2023-06-24 06:44:52 INFO [41 bytes] 200 .git/ORIG_HEAD
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [3101 bytes] 200 .git/?C=D;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [784 bytes] 200 .git/branches/?C=D;O=A
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/config is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/config
2023-06-24 06:44:52 ERROR [784 bytes] 200 .git/branches/?C=S;O=A
2023-06-24 06:44:52 INFO [73 bytes] 200 .git/description
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/?C=N;O=D is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/?C=N;O=D
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/?C=S;O=A is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/?C=S;O=A
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/?C=D;O=A is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/?C=D;O=A
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/?C=M;O=A is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/?C=M;O=A
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/applypatch-msg.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/applypatch-msg.sample
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/fsmonitor-watchman.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/fsmonitor-watchman.sample
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/commit-msg.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/commit-msg.sample
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/post-update.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/post-update.sample
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/pre-applypatch.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/pre-applypatch.sample
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/pre-commit.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/pre-commit.sample
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/pre-merge-commit.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/pre-merge-commit.sample
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/pre-rebase.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/pre-rebase.sample
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/prepare-commit-msg.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/prepare-commit-msg.sample
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/pre-push.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/pre-push.sample
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/pre-receive.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/pre-receive.sample
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/push-to-checkout.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/push-to-checkout.sample
2023-06-24 06:44:52 ERROR /tmp/tmpsrnhnk7n/.git/hooks/update.sample is potential dangerous, skip downloading this file
2023-06-24 06:44:52 INFO [137 bytes] 200 .git/index
2023-06-24 06:44:52 ERROR [971 bytes] 200 .git/info/?C=N;O=D
2023-06-24 06:44:52 ERROR [-1 bytes] -1 .git/hooks/update.sample
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [971 bytes] 200 .git/info/?C=M;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [971 bytes] 200 .git/info/?C=S;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [971 bytes] 200 .git/info/?C=D;O=A
2023-06-24 06:44:52 ERROR [1155 bytes] 200 .git/logs/?C=N;O=D
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1155 bytes] 200 .git/logs/?C=S;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1155 bytes] 200 .git/logs/?C=D;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 INFO [240 bytes] 200 .git/info/exclude
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1155 bytes] 200 .git/logs/?C=M;O=A
2023-06-24 06:44:52 ERROR [983 bytes] 200 .git/logs/refs/?C=N;O=D
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 INFO [713 bytes] 200 .git/logs/HEAD
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [983 bytes] 200 .git/logs/refs/?C=M;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [983 bytes] 200 .git/logs/refs/?C=S;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [983 bytes] 200 .git/logs/refs/?C=D;O=A
2023-06-24 06:44:52 ERROR [1192 bytes] 200 .git/logs/refs/heads/?C=S;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1192 bytes] 200 .git/logs/refs/heads/?C=M;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1192 bytes] 200 .git/logs/refs/heads/?C=D;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 INFO [271 bytes] 200 .git/logs/refs/heads/issue
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 INFO [279 bytes] 200 .git/logs/refs/heads/master
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1192 bytes] 200 .git/logs/refs/heads/?C=N;O=D
2023-06-24 06:44:52 ERROR [2278 bytes] 200 .git/objects/?C=N;O=D
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [2278 bytes] 200 .git/objects/?C=D;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [2278 bytes] 200 .git/objects/?C=M;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [2278 bytes] 200 .git/objects/?C=S;O=A
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/9c/?C=N;O=D
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/9c/?C=D;O=A
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/9c/?C=M;O=A
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/9c/?C=S;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 INFO [50 bytes] 200 .git/objects/9c/538c32764e530c6abff3e228c308a092670413
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/87/?C=M;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/87/?C=S;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/87/?C=N;O=D
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/87/?C=D;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 INFO [26 bytes] 200 .git/objects/87/deec7ce8187791b32212b9b48574d4c3e30cf2
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/99/?C=N;O=D
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/99/?C=S;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/99/?C=M;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/99/?C=D;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 INFO [139 bytes] 200 .git/objects/99/5559ed9ce055026668d1921f13fb7b3ba3ca51
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/ac/?C=S;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/ac/?C=N;O=D
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/ac/?C=M;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/ac/?C=D;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 INFO [20 bytes] 200 .git/objects/ac/f36e4efd5b16ddbeeee76152cb28f05a1ac167
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/bf/?C=N;O=D
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/bf/?C=S;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/bf/?C=D;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/bf/?C=M;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/e6/?C=N;O=D
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/e6/?C=S;O=A
2023-06-24 06:44:52 INFO [109 bytes] 200 .git/objects/bf/1f77ca0fee1858c138cef18e4b0b77a3a42fdc
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/e6/?C=M;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [1053 bytes] 200 .git/objects/e6/?C=D;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 INFO [50 bytes] 200 .git/objects/e6/823852a58e58cbd299847028ab776b30ddecb3
2023-06-24 06:44:52 ERROR [800 bytes] 200 .git/objects/info/?C=N;O=D
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [800 bytes] 200 .git/objects/info/?C=M;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [800 bytes] 200 .git/objects/info/?C=S;O=A
2023-06-24 06:44:52 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:52 ERROR [800 bytes] 200 .git/objects/info/?C=D;O=A
2023-06-24 06:44:53 ERROR [800 bytes] 200 .git/objects/pack/?C=M;O=A
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 ERROR [800 bytes] 200 .git/objects/pack/?C=D;O=A
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 ERROR [800 bytes] 200 .git/objects/pack/?C=N;O=D
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 ERROR [800 bytes] 200 .git/objects/pack/?C=S;O=A
2023-06-24 06:44:53 ERROR [1158 bytes] 200 .git/refs/?C=N;O=D
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 ERROR [1158 bytes] 200 .git/refs/?C=S;O=A
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 ERROR [1158 bytes] 200 .git/refs/?C=D;O=A
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 ERROR [1158 bytes] 200 .git/refs/?C=M;O=A
2023-06-24 06:44:53 ERROR [1177 bytes] 200 .git/refs/heads/?C=N;O=D
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 ERROR [1177 bytes] 200 .git/refs/heads/?C=S;O=A
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 ERROR [1177 bytes] 200 .git/refs/heads/?C=M;O=A
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 ERROR [1177 bytes] 200 .git/refs/heads/?C=D;O=A
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 INFO [41 bytes] 200 .git/refs/heads/issue
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 INFO [41 bytes] 200 .git/refs/heads/master
2023-06-24 06:44:53 ERROR [791 bytes] 200 .git/refs/tags/?C=N;O=D
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 ERROR [791 bytes] 200 .git/refs/tags/?C=M;O=A
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 ERROR [791 bytes] 200 .git/refs/tags/?C=D;O=A
2023-06-24 06:44:53 ERROR FileExistsError(17, 'File exists')
2023-06-24 06:44:53 ERROR [791 bytes] 200 .git/refs/tags/?C=S;O=A
2023-06-24 06:44:53 INFO Cloning downloaded repo from /tmp/tmpsrnhnk7n to result/fc518884ff3e37dfdb43722a40c9bdc9
2023-06-24 06:44:53 ERROR Cloning into 'result/fc518884ff3e37dfdb43722a40c9bdc9'...
done.
Traceback (most recent call last):
  File "/usr/local/bin/githacker", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/GitHacker/__init__.py", line 520, in main
    ).start()
      ^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/GitHacker/__init__.py", line 91, in start
    return self.sighted()
           ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/GitHacker/__init__.py", line 111, in sighted
    return self.git_clone()
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/GitHacker/__init__.py", line 229, in git_clone
    self.copy_useful_files()
  File "/usr/local/lib/python3.11/dist-packages/GitHacker/__init__.py", line 200, in copy_useful_files
    shutil.copy(src, dst)
  File "/usr/lib/python3.11/shutil.py", line 419, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.11/shutil.py", line 256, in copyfile
    with open(src, 'rb') as fsrc:
         ^^^^^^^^^^^^^^^
IsADirectoryError: [Errno 21] Is a directory: '/tmp/tmpsrnhnk7n/.git/objects/pack'

上面是我的执行后全部的显示,我是在/var/www/html/文件在初始化了一个我自己的git_test文件夹,存放了一个flag.php文件。使用的是apache2。
代码段在我这是整齐的,发出去就乱了,每行的开头是日期,然后Traceback和提问的兄弟差不多。

@glslowhand
Copy link

问题似乎解决了,发现git 中生成的文件与代码中要复制的并不相同,注释两行即可

files = [
            ".git/COMMIT_EDITMSG",
            ".git/HEAD",
            #".git/objects/pack",
            #".git/refs/stash",
        ]

以上代码从__init__.py的190行开始,没学过python如果有问题,请大佬指出。如下是我再次使用时,出现的报告:

┌──(root㉿kali)-[~]
└─# githacker --url http://127.0.0.1/git_test/.git/ --output-folder result
2023-06-24 21:54:01 INFO 1 urls to be exploited
2023-06-24 21:54:01 INFO Exploiting http://127.0.0.1/git_test/.git/ into result/fc518884ff3e37dfdb43722a40c9bdc9
2023-06-24 21:54:01 INFO Directory listing enable under: apache
2023-06-24 21:54:01 ERROR [2902 bytes] 200 .git/?C=S;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [2902 bytes] 200 .git/?C=D;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [2902 bytes] 200 .git/?C=N;O=D
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [2902 bytes] 200 .git/?C=M;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 INFO [23 bytes] 200 .git/HEAD
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 INFO [7 bytes] 200 .git/COMMIT_EDITMSG
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [784 bytes] 200 .git/branches/?C=M;O=A
2023-06-24 21:54:01 ERROR [784 bytes] 200 .git/branches/?C=D;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [784 bytes] 200 .git/branches/?C=N;O=D
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/config is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [784 bytes] 200 .git/branches/?C=S;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/config
2023-06-24 21:54:01 INFO [73 bytes] 200 .git/description
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/?C=S;O=A is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/?C=S;O=A
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/?C=N;O=D is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/?C=N;O=D
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/?C=D;O=A is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/?C=D;O=A
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/?C=M;O=A is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/?C=M;O=A
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/applypatch-msg.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/applypatch-msg.sample
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/commit-msg.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/commit-msg.sample
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/fsmonitor-watchman.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/fsmonitor-watchman.sample
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/pre-applypatch.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/pre-applypatch.sample
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/post-update.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/post-update.sample
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/pre-merge-commit.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/pre-merge-commit.sample
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/pre-commit.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/pre-commit.sample
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/pre-push.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/pre-push.sample
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/prepare-commit-msg.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/prepare-commit-msg.sample
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/pre-rebase.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/pre-rebase.sample
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/push-to-checkout.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/pre-receive.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/pre-receive.sample
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/push-to-checkout.sample
2023-06-24 21:54:01 ERROR /tmp/tmprjeycpcz/.git/hooks/update.sample is potential dangerous, skip downloading this file
2023-06-24 21:54:01 ERROR [-1 bytes] -1 .git/hooks/update.sample
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [971 bytes] 200 .git/info/?C=N;O=D
2023-06-24 21:54:01 ERROR [971 bytes] 200 .git/info/?C=M;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 INFO [209 bytes] 200 .git/index
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [971 bytes] 200 .git/info/?C=D;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [971 bytes] 200 .git/info/?C=S;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 INFO [240 bytes] 200 .git/info/exclude
2023-06-24 21:54:01 ERROR [1155 bytes] 200 .git/logs/?C=M;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [1155 bytes] 200 .git/logs/?C=N;O=D
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [1155 bytes] 200 .git/logs/?C=S;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [1155 bytes] 200 .git/logs/?C=D;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 INFO [439 bytes] 200 .git/logs/HEAD
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [983 bytes] 200 .git/logs/refs/?C=D;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [983 bytes] 200 .git/logs/refs/?C=M;O=A
2023-06-24 21:54:01 ERROR [983 bytes] 200 .git/logs/refs/?C=N;O=D
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [983 bytes] 200 .git/logs/refs/?C=S;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [1194 bytes] 200 .git/logs/refs/heads/?C=M;O=A
2023-06-24 21:54:01 ERROR [1194 bytes] 200 .git/logs/refs/heads/?C=S;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [1194 bytes] 200 .git/logs/refs/heads/?C=N;O=D
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [1194 bytes] 200 .git/logs/refs/heads/?C=D;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 INFO [145 bytes] 200 .git/logs/refs/heads/master
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 INFO [283 bytes] 200 .git/logs/refs/heads/secret
2023-06-24 21:54:01 ERROR [2278 bytes] 200 .git/objects/?C=N;O=D
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [2278 bytes] 200 .git/objects/?C=S;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [2278 bytes] 200 .git/objects/?C=M;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [2278 bytes] 200 .git/objects/?C=D;O=A
2023-06-24 21:54:01 ERROR [1053 bytes] 200 .git/objects/2c/?C=N;O=D
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [1053 bytes] 200 .git/objects/2c/?C=M;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [1053 bytes] 200 .git/objects/2c/?C=S;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [1053 bytes] 200 .git/objects/2c/?C=D;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 INFO [81 bytes] 200 .git/objects/2c/0d838e984442be3c38e6a8883a504ecce6f318
2023-06-24 21:54:01 ERROR [1053 bytes] 200 .git/objects/3c/?C=S;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [1053 bytes] 200 .git/objects/3c/?C=N;O=D
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [1053 bytes] 200 .git/objects/3c/?C=M;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 ERROR [1053 bytes] 200 .git/objects/3c/?C=D;O=A
2023-06-24 21:54:01 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:01 INFO [144 bytes] 200 .git/objects/3c/76002cc5780c1885250cfef364a69b7dd41565
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/31/?C=M;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/31/?C=N;O=D
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/31/?C=S;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/31/?C=D;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 INFO [30 bytes] 200 .git/objects/31/6d3243577d12a4953ca98aa79514002df5d3ca
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/69/?C=N;O=D
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/69/?C=M;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/69/?C=S;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/69/?C=D;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 INFO [51 bytes] 200 .git/objects/69/0e3a8aa95a224d8701002b6a3bacf8d1e041eb
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/74/?C=N;O=D
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/74/?C=D;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/74/?C=S;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/74/?C=M;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 INFO [115 bytes] 200 .git/objects/74/efd58762bec9bd4aae817c8ba227614ab521a3
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/e6/?C=M;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/e6/?C=S;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/e6/?C=N;O=D
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1053 bytes] 200 .git/objects/e6/?C=D;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 INFO [15 bytes] 200 .git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
2023-06-24 21:54:02 ERROR [800 bytes] 200 .git/objects/info/?C=D;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [800 bytes] 200 .git/objects/info/?C=S;O=A
2023-06-24 21:54:02 ERROR [800 bytes] 200 .git/objects/info/?C=N;O=D
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [800 bytes] 200 .git/objects/info/?C=M;O=A
2023-06-24 21:54:02 ERROR [800 bytes] 200 .git/objects/pack/?C=N;O=D
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [800 bytes] 200 .git/objects/pack/?C=M;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [800 bytes] 200 .git/objects/pack/?C=S;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [800 bytes] 200 .git/objects/pack/?C=D;O=A
2023-06-24 21:54:02 ERROR [1158 bytes] 200 .git/refs/?C=S;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1158 bytes] 200 .git/refs/?C=M;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1158 bytes] 200 .git/refs/?C=D;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1158 bytes] 200 .git/refs/?C=N;O=D
2023-06-24 21:54:02 ERROR [1179 bytes] 200 .git/refs/heads/?C=D;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1179 bytes] 200 .git/refs/heads/?C=N;O=D
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1179 bytes] 200 .git/refs/heads/?C=S;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [1179 bytes] 200 .git/refs/heads/?C=M;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 INFO [41 bytes] 200 .git/refs/heads/master
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 INFO [41 bytes] 200 .git/refs/heads/secret
2023-06-24 21:54:02 ERROR [791 bytes] 200 .git/refs/tags/?C=M;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [791 bytes] 200 .git/refs/tags/?C=S;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [791 bytes] 200 .git/refs/tags/?C=D;O=A
2023-06-24 21:54:02 ERROR FileExistsError(17, 'File exists')
2023-06-24 21:54:02 ERROR [791 bytes] 200 .git/refs/tags/?C=N;O=D
2023-06-24 21:54:02 INFO Cloning downloaded repo from /tmp/tmprjeycpcz to result/fc518884ff3e37dfdb43722a40c9bdc9
2023-06-24 21:54:02 ERROR Cloning into 'result/fc518884ff3e37dfdb43722a40c9bdc9'...
done.
2023-06-24 21:54:02 INFO Check it out: result/fc518884ff3e37dfdb43722a40c9bdc9
2023-06-24 21:54:02 INFO 1 / 1 were exploited successfully
2023-06-24 21:54:02 INFO http://127.0.0.1/git_test/.git/ -> result/fc518884ff3e37dfdb43722a40c9bdc9

┌──(root㉿kali)-[~]
└─# cd result/fc518884ff3e37dfdb43722a40c9bdc9

┌──(root㉿kali)-[~/result/fc518884ff3e37dfdb43722a40c9bdc9]
└─# git reflog
3c76002 (HEAD -> secret, origin/secret, origin/HEAD) HEAD@{0}: commit: secret
74efd58 (origin/master) HEAD@{1}: checkout: moving from master to secret
74efd58 (origin/master) HEAD@{2}: commit (initial): master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants