Monday, July 8, 2024

GreenBone GVM Community on KaliLinux admin password reset

 After trying all possible GVM command to get access to GUI after setup I found the only way how it worked for me. 

I have to change password directly on DB. Here are steps. And I tried to run this wihtout stopping service and it worked anyway. 

I;'m assuming that you know KALI terminal. You need 2 of them one for SQL and another for other things including HASH generation

Directly Resetting the Admin Password in PostgreSQL

  1. Stop the GVM services:

    sh

    sudo systemctl stop gvmd sudo systemctl stop ospd-openvas
  2. Access the PostgreSQL database: You need to access the gvmd database. The default user is usually postgres. Use the following command to access the PostgreSQL command line:

    sh

    sudo -u postgres psql gvmd
  3. List the users in the gvmd database:

    sql

    SELECT name FROM users;

    This will list all users. Identify the admin user.

  4. Reset the password: Replace admin_username with the actual username of your admin account, and newpassword with your desired password. Note that the password needs to be hashed.

    Generate a new password hash using gvmd command:


    sudo gvmd --user=admin_username --new-password=newpassword

    This should display a hash. If this does not work, you can generate the password hash using Python:

    python

    python3 -c "import crypt; print(crypt.crypt('newpassword', crypt.mksalt(crypt.METHOD_SHA512)))"
  5. Update the user's password in the PostgreSQL database:

    sql

    UPDATE users SET password='hashed_password' WHERE name='admin_username';
  6. Exit the PostgreSQL command line:

    sql

    \q
  7. Start the GVM services again:

    sh

    sudo systemctl start ospd-openvas sudo systemctl start gvmd
  8. Verify the Password Reset: Try logging into the GVM web interface with the new password to ensure the reset was successful.

Sunday, May 20, 2018

Fixing or Setting Bridged Network on VMware Workstation for Kali LInux ( 2018)

If your Kali Linux Virtual Machine not accepting bridged connection from VMWare Workstation


1) Stop Virtual machine.
2) Run VMWare Workstation as admin
3) Open Virtual Network Editor. Edit --- Virtual Network Editor
4) Remove network VMnet0
5) Add Network VMnet0
6) Restart VMWare Workstation
7) Start guest and reset connection



Thursday, April 26, 2018

Convert DNS name to IP address in bulk text file

Just really useful script

https://gallery.technet.microsoft.com/scriptcenter/Convert-DNS-name-to-IP-e74f8b01


foreach ($computer in (get-content C:\computers.txt)) { 
  Try{  
    [system.net.Dns]::GetHostAddresses($computer) | Foreach-Object { 
      add-content -path C:\computersips.txt -value "$computer,$($_.IPAddressToString)" 
    } 
  } Catch { 
    add-content -path C:\computersips.txt -value "$computer,Cannot resolve hostname" 
  } 
}

Nmap result parser to CVE. Simple Nmap Parser

Found this little gem for parsing nMap result for reports.

Simple Nmap Parser

https://www.hackwhackandsmack.com/?p=441

Wednesday, January 31, 2018

Bulk IP CIDR to IP list converter,

This is useful for OpenVAS
https://www.cidrcalculator.com/ipv4/cidr-to-ip-list-bulk.html?lang=en

Can't connect to OPENVAS from external network. Fix



/lib/systemd/system/greenbone-security-assistant.service

changed --listen=127.0.0.1 to --listen=0.0.0.0 
then after changing and saving

Stop and start Openvas service.

Nesuss Excluding list of IP from scan

Recently I found that I need to exclude some IPs from scan.
As I did it in windows :

In the c:\ProgramData\Tenable\Nessus\conf\nessusd.rules


# Target Syntax: accept|reject address/netmask:port[-port_max]
#
# Reject any target on 10.42.***
 reject 65.132.***
 reject 50.233.***
 reject 96.93.***
 reject 216.174.***


As this IPs were in the different places subnets, i used this way. May be there is different and better way.

Fixing connection to Internet for Kali linux on VMWare

When I was trying to connect KALI VM to the network with "BRIDGET" network settings I found that cannot get on Internet, my update upgrade not worked and I got some different errors as :

- Cannot apt-get update. Err:1 http://http.kali.org/kali kali-rolling InRelease

- Unable to locate Package

Here is summary of troubleshooting 

1) Check DNS server, I'm using 8.8.8.8
2) Check if  /etc/apt/sources.list  have record   and it is deb http://http.kali.org/kali kali-rolling main contrib non-free  and it is non commented.
3)  On VM Edit>Virtual Network Editor  use Restore Defaults buttons ( as admin).
4) On Virutal Network Editor check dropdown menu if it is bridget to the proper interface


Monday, April 11, 2016

How manually update ZAP proxy on Kali linux.


1) Download latest version https://github.com/zaproxy/zaproxy/wiki/Downloads

   * in my case it is ZAP_2.4.3_Linux.tar.gz

2) Untar it tar -xzvf ZAP_2.4.3_Linux.tar.gz

3) cd ZAP_2.4.3/

 
4) Copy new version over old : cp -Ra * /usr/share/zaproxy/

Monday, March 16, 2015

Reversing .NET applications.



All screenshots has been done with http://getgreenshot.org. This is amazing application and free. If you like it, please donate.

! If you are developing .NET application for commercial sale, you must implement protection which is other than simple obfuscation. There is tools on market which can deobfusicate .NET . One of them

Tools


De4dot http://de4dot.com/  - tool for deobfusication

FEATURES

  • Inline methods.
  • Decrypt strings statically or dynamically.
  • Decrypt constants.
  • Decrypt methods statically or dynamically.
  • Remove proxy methods.
  • Rename symbols.
  • Devirtualize virtualized code.
  • Decrypt resources.
  • Decrypt embedded files.
  • Remove tamper detection code
  • Remove anti-debug code
  • Control flow deobfuscation.
  • Restore class fields.
  • Convert a PE exe to a .NET exe.
  • Removes most/all junk classes added by the obfuscator.
  • Fixes some peverify errors.
  • Restore the types of method parameters and fields.

OBFUSCATORS / PACKERS

  • Agile.NET (aka CliSecure)
  • Babel.NET
  • CodeFort
  • CodeVeil
  • CodeWall
  • CryptoObfuscator
  • DeepSea Obfuscator
  • Dotfuscator
  • .NET Reactor
  • Eazfuscator.NET
  • Goliath.NET
  • ILProtector
  • MaxtoCode
  • MPRESS
  • Rummage
  • Skater.NET
  • SmartAssembly
  • Spices.Net
  • Xenocode


Add-ons for Reflector :
1)     If you want to modify code : http://reflexil.net/
Reflexil is an assembly editor and runs as a plug-in for Red Gate's Reflector, ILSpy and Telerik's JustDecompile. Reflexil is using Mono. Cecil, written by Jb Evain and is able to manipulate IL code and save the modified assemblies to disk. Reflexil also supports C#/VB.NET code injection. 
2)      If you need search in Reflector: http://reflectoraddins.codeplex.com/wikipage?title=CodeSearch Code Search is an add-in for .Net Reflector that allows searching within the source code.

To install addons :

And 





Decrypting obfuscated files

1)      Download and unzip de4dot .
2)      Drag and drop obfuscated file on de4dot icon
3)      You will get TestRename-cleaned.exe


In my case I took file TestRename.exe and DragNDrop on de4dot.exe. If you have 64 bit application, that drop on de4dot-x64.exe.
Couple seconds later you will see new file created TestRename-cleaned.exe. this is deobfusicated file which you can use in Reflector..




 Reflector:

You can try to use http://ilspy.net/ as well.

Simple way

1)      Open assembly :





When you will open assembly, you can search though the code for “goodies”:






Or you can simply export source code to other folder and work with it in Notepad++ or other free text editor:





In my case after exporting (decompile) code, in exported directory I was searching for  “License” text and getting list of  files which contain some interesting information:

In one file I found :
private string GetDiscountCoupon(DiscountypeEnum dt)
        {
            switch (dt)
            {
                case DiscountypeEnum.Percent10:
                    return "LIZA-DPQT";

                case DiscountypeEnum.Percent15:
                    return "LIZA-7XY4-IPCX";

                case DiscountypeEnum.Percent20:
                    return "LIZA-AM84-XDVM";

                case DiscountypeEnum.Percent25:
                    return "LIZA-R08M-AWTK";

                case DiscountypeEnum.Percent50:
                    return "LIZ-R764-LPL";
            }
            return "";

This is list of discounts.

And in another file  I found:

      Data encryptedData = new Data {
                Hex = str2
            };
            return new Symmetric(Symmetric.Provider.TripleDES, true) { Key = { Text = "EzF6@CD4-72$C-49b3-96*-329di949mcoB49}" } }.Decrypt(encryptedData).Text;
        }

        public static bool RegisterApplication(string key)
        {
            key = key.Trim();
            string str2 = "B4FA7A5DA5AF2E63D97F819A5362CDA0";
            Hash hash = new Hash(Hash.Provider.MD5);
            Data d = new Data(key);
            string hex = hash.Calculate(d).Hex;
            if (((str2.Length > 5) && (key.Length < 30)) && (hex == str2))
            {
                SetAppConfig("KH", hex, true);
                SetAppConfig("RD", Conversions.ToString(DateTime.Today), true);
                m_IsRegisteredProduct = 0;
                return true;

Where I found : string str2 = "B4FA7A5DA5AF2E63D97F819A5362CDA0";
            Hash hash = new Hash(Hash.Provider.MD5);

On the website: http://www.md5online.org/ decrypting this hash revealing the registration key.
That was easiest reversing which I ever done.
Complicated way ( will follow )


Wednesday, January 28, 2015

Removing password from protected PDF documents

$ pdftops [your_protected_pdf_document.pdf] out.ps

$ ps2pdf [out.ps] broken_protection_pdf_document.pdf 
http://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/
Type the following command to install the qpdf: $ sudo apt-get install xpdf-utilsFirst, decrypt a PDF and create a postscript file, enter:
pdftops input.pdf out.ps
You will get input.ps file. This can be printed or open under Linux itself. But, you can convert it back .ps file (postscript)back to a PDF as follows:
ps2pdf out.ps ready.pdf
Please note that the ps2pdf command is part of ghostscript and it will get installed when you run xpdf-utils.
Now you can convert it with Nitro PDF https://www.gonitro.com/pro

Wednesday, January 21, 2015

Remove Admin Password from Win 7, 8, 2008 etc for free

http://pogostick.net/~pnh/ntpasswd/bootdisk.html

***************************************************************************
*                                                                         *
*         Windows Change Password / Registry Editor / Boot CD             *
*                                                                         *
*  (c) 1998-2014 Petter Nordahl-Hagen. Distributed under GNU GPL v2       *
*                                                                         *
* DISCLAIMER: THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTIES!          *
*             THE AUTHOR CAN NOT BE HELD RESPONSIBLE FOR ANY DAMAGE       *
*             CAUSED BY THE (MIS)USE OF THIS SOFTWARE                     *
*                                                                         *
* More info at: http://pogostick.net/~pnh/ntpasswd/                       *
* Email       : pnh@pogostick.net                                         *
***************************************************************************

Just boot this CD and follow instructions.
Usually, just pressing return/enter should work, except some
drivers may have to be loaded manually with the 'm' menu option after boot.

 ---

The password reset and registry edit has now been tested with the following:

NT 3.51, NT 4, Windows 2000, Windows XP, Windows 2003 Server,
Vista, Windows 7, Server 2008, Windows 8, Windows 8.1, Server 2012

As far as I know, it will work with all Service Packs (SP) and
all editions (Professional, Server, Home etc)
Also, 64 bit windows versions shold be OK.

 ---

To make a bootable USB drive / key:

1. Copy all files from this CD onto the USB drive.
   It cannot be in a subdirectory on the drive.
   You do not need delete files already on the drive.
2. Install the bootloader
   On the USB drive, there should now be a file "syslinux.exe".
   Start a command line window (cmd.exe) with "run as administrator"
   From the command line, run the command like this:


j:\syslinux.exe -ma j:

replace j with some other letter if your USB drive is on another
drive letter than j:
On some drives, you may have to omit the -ma option if you
get an error.
If it says nothing, it probably did install the bootloader.

Please note that you may have to adjust settings in your computers BIOS
setup to boot from USB.
Also, some BIOS (often older machines) simply won't boot from USB anyway.
Unfortunately, there are extremely many different versions of BIOS,
and a lot of them are rather buggy when it comes to booting off different
media, so I am unable to help you.


Tuesday, January 13, 2015

Searching - Replacing in log files

Long time ago I found amazing tool to do such kind of tasks:

http://www.mind-pioneer.com/

Here -how to extract IP addresses from log file:

http://www.mind-pioneer.com/services/419_Text_file_parser.html


This is small list what you can do with IP addresses in  logs :

http://www.mind-pioneer.com/services/conv_search.php?key=IP+address&type=all&x=30&y=12