homebrew-pentest icon indicating copy to clipboard operation
homebrew-pentest copied to clipboard

installing dirb fails Errno::ENOTEMPTY

Open gorzilla opened this issue 7 years ago • 15 comments

I'm using mojave

==> Installing sidaf/pentest/dirb ==> Downloading http://downloads.sourceforge.net/project/dirb/dirb/2.22/dirb222.tar.gz ==> Downloading from https://kent.dl.sourceforge.net/project/dirb/dirb/2.22/dirb222.tar.gz ######################################################################## 100.0% cp: /private/tmp/d20181016-34625-11yurq4/dirb222/.: Permission denied Error: An exception occurred within a child process: Errno::ENOTEMPTY: Directory not empty @ dir_s_rmdir - /private/tmp/d20181016-34625-11yurq4

gorzilla avatar Oct 16 '18 12:10 gorzilla

using mojave and having the same problem too.

running brew install with verbose and debug switches on shows this:

== all expected initial output == ==> Verifying 909dd856145ab18654a4e71ceb4f22cebcead82af6346b217b84864203a2e05a--dirb222.tar.gz checksum tar xf --removed--dirb222.tar.gz -C /private/tmp/d20181125-45893-15ydh35 cp -pR /private/tmp/d20181125-45893-15ydh35/dirb222/. /private/tmp/dirb-20181125-45893-1m4ygmc/dirb222 cp: /private/tmp/d20181125-45893-15ydh35/dirb222/.: Permission denied

The cp -pR command cause the problem as at that stage, dirb222 directory still has permission 644 when extracted.

why the command >> system "chmod", "-R", "744", "dirb222" did not take place at this time?

I'm quite new to homebrew hence not sure how the homebrew formula steps is being carried out at this point of the execution.

salleh avatar Nov 25 '18 15:11 salleh

So no solution yet?

Ahren-Posthumus avatar Dec 06 '18 09:12 Ahren-Posthumus

On mac: It seems to be a permission issue, So I tried multiple things. The closest I got was by moving the archive to an accessible directory with
mv /Users/<user>/Library/Caches/Homebrew/downloads/<guid>-dirb222.tar.gz Then double clicked on that to extract it. I then did a recursive chmod to give permissions on all files inside chmod -R 774 dirb222/* Then I re-compressed the directory with the same name as the original (obvs first delete the original to avoid a collision) tar -zcvf <guid>-dirb222.tar.gz dirb222 Them move that compressed file back to /Users//Library/Caches/Homebrew/downloads/

Now the issue that you will face is that the checksum won't match up. Run brew install dirb again , you will get an error telling you this. Copy the 'actual'. Seeing as you edited the file yourself and can trust it, you can just locate the formula-- The thing that tells brew how to install the package-- (most likely here: /usr/local/Homebrew/Library/Taps/sidaf/homebrew-pentest/dirb.rb) and update the md5 checksum manually. If you open the file with nano or vim you will see the header there. edit it with the 'actual' that you copied.

This gets me past the error, but then the chmod breaks... so i don't know... I tried messing with the formula a little more, to no avail. Hopefully someone else can get us past this next hurdle.

Ahren-Posthumus avatar Dec 06 '18 10:12 Ahren-Posthumus

After following the steps above:

I literally just changed the directories in the tap.rb to the full path in /private/tmp and got as far as it failing to link (at which point I just ran brew link --overwrite dirb).

Seems to work.

ghost avatar Mar 05 '19 00:03 ghost

Exactly the same problem

:~$brew install sidaf/pentest/dirb

==> Installing dirb from sidaf/pentest ==> Downloading http://downloads.sourceforge.net/project/dirb/dirb/2.22/dirb222.tar.gz Already downloaded: /Users/zoro/Library/Caches/Homebrew/downloads/909dd856145ab18654a4e71ceb4f22cebcead82af6346b217b84864203a2e05a--dirb222.tar.gz cp: /private/tmp/d20190309-17893-1oushhe/dirb222/.: Permission denied Error: An exception occurred within a child process: Errno::ENOTEMPTY: Directory not empty @ dir_s_rmdir - /private/tmp/d20190309-17893-1oushhe

zoro96 avatar Mar 08 '19 14:03 zoro96

same -

Updating Homebrew...
==> Installing dirb from sidaf/pentest
==> Downloading http://downloads.sourceforge.net/project/dirb/dirb/2.22/dirb222.tar.gz
Already downloaded: /Users/mark/Library/Caches/Homebrew/downloads/909dd856145ab18654a4e71ceb4f22cebcead82af6346b217b84864203a2e05a--dirb222.tar.gz
cp: /private/tmp/d20190413-8564-1kci0mv/dirb222/.: Permission denied
Error: An exception occurred within a child process:
  Errno::ENOTEMPTY: Directory not empty @ dir_s_rmdir - /private/tmp/d20190413-8564-1kci0mv

markroxor avatar Apr 13 '19 06:04 markroxor

No-one is going to fix it guys, look at the README just do it yourself. What to do is right here in the above posts :P

ghost avatar Apr 13 '19 08:04 ghost

@6661696c Can you elaborate your solution? Did it really work?

markroxor avatar Apr 13 '19 09:04 markroxor

Unextract, chmod, retar, change checksum, rename directory in tar.rb to where it actually is in /tmp/private, and after linking fails brew link --overwrite dirb

And it worked for me.

ghost avatar Apr 13 '19 16:04 ghost

The explanation that 6661696c provided is correct, but a bit short and confusing. If you have followed along to the explanation given by Ahren-Posthumus, you have come to a point where the following error occurs.

chmod: dirb222: No such file or directory

This is the error that we have to resolve. We resolve this by changing the following lines in /usr/local/Homebrew/Library/Taps/sidaf/homebrew-pentest/dirb.rb:

system "chmod", "-R", "744", "dirb222" cd "dirb222" do

We change these line to:

system "chmod", "-R", "744", "/private/tmp/<guid>/dirb222" cd "/private/tmp/<guid>/dirb222" do

In my case this fix worked and I can simply run dirb from the command line. If there are still linking issues try brew link --overwrite dirb

pjpronk avatar May 31 '19 16:05 pjpronk

I have forked this repo and got this issue fixed. If anybody want use it, try brew install swordfith/pentest/dirb pls. And I proposed a pull request, hope sidaf can accept that.

SwordFaith avatar Aug 10 '19 11:08 SwordFaith

@SwordFaith I believe you meant brew install swordfaith/pentest/dirb (missing a in swordfaith)

mgoodric avatar Aug 20 '19 17:08 mgoodric

Thanks a lot mgoodric for this solution

sousou39 avatar Oct 08 '19 22:10 sousou39

thanks a lot

armanayvazyan avatar Jun 12 '20 22:06 armanayvazyan

@SwordFaith Thank you so much, and I think you were right to issue a pull request. This is a major issue.

@mgoodric Thanks so much for the typo solve.

bclark08 avatar Nov 03 '20 14:11 bclark08