InsiderPhD / Generic-University

Vulnerable API
389 stars 102 forks source link

Issue setting up #34

Open CyberBishop opened 2 years ago

CyberBishop commented 2 years ago

└─$ composer update

Loading composer repositories with package information Updating dependencies Nothing to modify in lock file Installing dependencies from lock file (including require-dev) Nothing to install, update or remove Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested. Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead. Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested. Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump Deprecation Notice: Return type of Illuminate\Container\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Container/Container.php:1270 Deprecation Notice: Return type of Illuminate\Container\Container::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Container/Container.php:1281 Deprecation Notice: Return type of Illuminate\Container\Container::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Container/Container.php:1293 Deprecation Notice: Return type of Illuminate\Container\Container::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Container/Container.php:1306
@php artisan package:discover --ansi PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1349 Stack trace:

0 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Support/Collection.php(11): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()

1 /home/alvin/Downloads/Generic-University/vendor/composer/ClassLoader.php(571): include('...')

2 /home/alvin/Downloads/Generic-University/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()

3 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Support/helpers.php(110): Composer\Autoload\ClassLoader->loadClass()

4 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(130): collect()

5 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(106): Illuminate\Foundation\PackageManifest->build()

6 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(89): Illuminate\Foundation\PackageManifest->getManifest()

7 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(78): Illuminate\Foundation\PackageManifest->config()

8 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php(26): Illuminate\Foundation\PackageManifest->aliases()

9 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(230): Illuminate\Foundation\Bootstrap\RegisterFacades->bootstrap()

10 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\Foundation\Application->bootstrapWith()

11 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\Foundation\Console\Kernel->bootstrap()

12 /home/alvin/Downloads/Generic-University/artisan(37): Illuminate\Foundation\Console\Kernel->handle()

13 {main} in /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Support/Collection.php on line 11

In Collection.php line 11:

During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Ill
uminate\Support\Collection::offsetExists($key) should either be compatible wit
h ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChan
ge] attribute should be used to temporarily suppress the notice in /home/alvin
/Downloads/Generic-University/vendor/laravel/framework/src/Illuminate/Support/
Collection.php:1349
Stack trace:

0 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illum

inate/Support/Collection.php(11): Illuminate\Foundation\Bootstrap\HandleExcept
ions->handleError()

1 /home/alvin/Downloads/Generic-University/vendor/composer/ClassLoader.php(57

1): include('...')

2 /home/alvin/Downloads/Generic-University/vendor/composer/ClassLoader.php(42

8): Composer\Autoload\includeFile()

3 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illum

inate/Support/helpers.php(110): Composer\Autoload\ClassLoader->loadClass()

4 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illum

inate/Foundation/PackageManifest.php(130): collect()

5 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illum

inate/Foundation/PackageManifest.php(106): Illuminate\Foundation\PackageManife
st->build()

6 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illum

inate/Foundation/PackageManifest.php(89): Illuminate\Foundation\PackageManifes
t->getManifest()

7 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illum

inate/Foundation/PackageManifest.php(78): Illuminate\Foundation\PackageManifes
t->config()

8 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illum

inate/Foundation/Bootstrap/RegisterFacades.php(26): Illuminate\Foundation\Pack
ageManifest->aliases()

9 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illum f

inate/Foundation/Application.php(230): Illuminate\Foundation\Bootstrap\Registe
rFacades->bootstrap()

10 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illu

minate/Foundation/Console/Kernel.php(310): Illuminate\Foundation\Application->
bootstrapWith()

11 /home/alvin/Downloads/Generic-University/vendor/laravel/framework/src/Illu

minate/Foundation/Console/Kernel.php(127): Illuminate\Foundation\Console\Kerne
l->bootstrap()

12 /home/alvin/Downloads/Generic-University/artisan(37): Illuminate\Foundatio

n\Console\Kernel->handle()

13 {main}

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

parrotassassin15 commented 2 years ago

did this ever get a fix? @InsiderPhD I am getting the same issue

nikesh123-sys commented 2 years ago

I'm also getting same error

spiceysec commented 1 year ago

i get the same issue

Jeremy5909 commented 1 year ago

Any updates on this? I'm using Kali Linux btw

burdy1971 commented 1 year ago

I tried to set it up, but failed due to the same issue. I started using the docker solution using this page: https://hub.docker.com/r/busk3r/genericuniversity. It failed me as well.

Starting the first docker command throws an error like this: Starting MySQL database server mysqld su: warning: cannot change directory to /nonexistent: No such file or directory

However, I managed to solve it. So the docker option might still be something for everyone. Solution is to "debug" the situation by opening a bash shell and just snoop around using: docker exec -it container-name bash. (Note: find container name with: docker ps)

docker exec -it genericuniversity bash

;Test Mysql: root@74a89f2e0248:/# /etc/init.d/mysql start

;Apparently mysql needs a dir named "/nonexistent":

root@74a89f2e0248:/etc# grep -ri nonexistent passwd:nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin passwd:_apt:x:100:65534::/nonexistent:/usr/sbin/nologin passwd:mysql:x:101:102:MySQL Server,,,:/nonexistent:/bin/false passwd-:nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin passwd-:_apt:x:100:65534::/nonexistent:/usr/sbin/nologin passwd-:mysql:x:101:102::/nonexistent:/bin/false

;Resolve it: root@74a89f2e0248:~# mkdir /nonexistent

;Test Mysql: root@74a89f2e0248:~# /etc/init.d/mysql start Starting MySQL database server mysqld
[ OK ]

;Exit the shell:

exit

;Commit it to a new image name, using: docker commit container-ID image-name. (Note. Find containerID with docker ps):

docker commit 74a89f2e0248 genericuniversity_v2

;Run the initial command with the new image name:

docker run --name genericuniversity_v2 -itd --rm -p 80:8000 genericuniversity_v2 && docker exec genericuniversity_v2 service mysql start && docker exec genericuniversity_v2 mysql -u root -p -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';"

;Start the container:

docker exec genericuniversity_v2 php /root/Generic-University/artisan serve --host 0.0.0.0

And you're back in business!

colin2178 commented 1 year ago

Nice .... I was beating my head against a wall trying to get this running. I'm in business much appreciated!

jumpman234 commented 1 year ago

I use an M1 Macbook and I had the same error CyberBishop posted, was unable to resolve it. I have also tried the docker alternative but there is no docker image for arm64. Is there any alternative i can try apart from changing my laptop :(

burdy1971 commented 1 year ago

@jumpman234 , try to experiment with the option: --platform linux/amd64

jumpman234 commented 1 year ago

@burdy1971 this is the error i get: 8eb891b300c4b583005395433d410035428e760801e80aeeb8cc7f8512ea658d Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/genericuniversity/json": dial unix /var/run/docker.sock: connect: permission denied

burdy1971 commented 1 year ago

For some reason the user that you are using cannot acces the docker engine. Try to start it with sudo. There are many fine answers on your issue when you search for it using google. Good luck :)

jumpman234 commented 1 year ago

@burdy1971 thank you, tried it with sudo it but it didn't work cos of the arm spec. i was able to get an arm docker image for damn vulnrable web app, but the username and password don't work on the webapp login page

burdy1971 commented 1 year ago

Well, great that you have the docker part working. Can you specify for others how you managed to set it up? Second, I don't understand your question. I believe you have to hack yourself in. There is no known username and password....

jumpman234 commented 1 year ago

Apologies for the confusion:

  1. I was unable to launch generic-university webapp, cos my M1 mac is not compatible with the amd64 image.
  2. I got an arm64 image for Damn Vulnerable webapp(dvwa) -- https://hub.docker.com/r/cytopia/dvwa 3.However, dvwa requires you to login and reset it with default credential (admin/ p@ssw0rd) --- but the credentials are not working, and it does not output any error. I thought my DB was not running or is not connected to the webapp, but everything looks good according to answers I have seen online

Well, great that you have the docker part working. Can you specify for others how you managed to set it up? Second, I don't understand your question. I believe you have to hack yourself in. There is no known username and password....