├── README.md └── gitpillage.sh /README.md: -------------------------------------------------------------------------------- 1 | ## Why gitpillage? ## 2 | I thought it would be useful to automate some other techniques I found to extract code, configs and other information from a git repo identified in a web root that was not 100% cloneable. Gitpillage extracts as much knowledge about the repo as possible through predictable file names and known object hashes. 3 | 4 | 5 | ## Requirements ## 6 | 7 | Basic requirements usually fulfilled by any *nix system. 8 | 9 | * bash 10 | * wget or curl 11 | * grep 12 | * awk 13 | 14 | 15 | ## Usage ## 16 | gitpillage.sh hostname/directory 17 | (directory is optional) 18 | 19 | Example: 20 | 21 | `gitpillage.sh www.example.com/images (would crawl http://example.com/images/.git/)` 22 | 23 | `gitpillage.sh www.example.com (would crawl http://example.com/.git/)` 24 | 25 | 26 | ## WTF does this mean ## 27 | 28 | `` 29 | cat: Moved: No such file or directory 30 | cat: Permanently: No such file or directory 31 | cat: document: No such file or directory 32 | cat: (Unix): No such file or directory 33 | `` 34 | 35 | Chances are you are getting hit with a redirect. If you are trying to pillage example.com try www.example.com instead. 36 | 37 | ## Contributors ## 38 | [Michael Garvin](http://github.com/wraithgar) 39 | 40 | ## License ## 41 | 42 | Written by [Adam Baldwin](http://github.com/evilpacket). 43 | Copyright © 2011 by nGenuity Information Services, LLC. Released under the terms of the MIT License: 44 | 45 | Permission is hereby granted, free of charge, to any person obtaining a copy 46 | of this software and associated documentation files (the "Software"), to deal 47 | in the Software without restriction, including without limitation the rights 48 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 49 | copies of the Software, and to permit persons to whom the Software is 50 | furnished to do so, subject to the following conditions: 51 | 52 | The above copyright notice and this permission notice shall be included in 53 | all copies or substantial portions of the Software. 54 | 55 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 56 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 57 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 58 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 59 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 60 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 61 | THE SOFTWARE. 62 | -------------------------------------------------------------------------------- /gitpillage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ -z $1 ]]; then 4 | cat<&1 |grep "^error:"|awk '{print $5}'` 100 | if [ "$file" == "$prev" ] 101 | then 102 | break 103 | fi 104 | getsha $file 105 | done 106 | 107 | #8 - try and checkout files. It's not perfect, but you might get lucky 108 | for line in `git ls-files` 109 | do 110 | git checkout $line 111 | done 112 | --------------------------------------------------------------------------------