nmap could not locate nse_main.lua - nmap

When I try to use the following
nmap -p 443 -Pn --script=ssl-cert ip_address
I get the following error:
Starting Nmap 7.70 ( https://nmap.org ) at 2019-06-04 15:20 UTC
NSE: failed to initialize the script engine:
could not locate nse_main.lua
stack traceback:
[C]: in ?
QUITTING!
the response for nmap --version
is
Nmap version 7.70 ( https://nmap.org )
Platform: x86_64-alpine-linux-musl
Compiled with: liblua-5.3.5 openssl-1.1.1a libssh2-1.8.0 libz-1.2.11 libpcre-8.42 libpcap-1.9.0-PRE-GIT nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: epoll poll select

You need to install the package nmap-scripts as well, as this is not installed automatically on Alpine (see here).
So simply run apk add nmap-scripts or add it to your dockerfile.

Related

CISCO IOS-XR, Python3.7, Not able to run commands like 'ls' and 'df' on Cisco router

Cisco ios-xr router using CLI:
RP/0/RP0#show version
Thu Nov 25 07:53:59.103 UTC
Cisco IOS XR Software, Version 6.5.32.11I
Copyright (c) 2013-2020 by Cisco Systems, Inc.
RP/0/RP0#run
Thu Nov 25 07:54:05.231 UTC
[xr-vm_node0_RP0_CPU0:~]$df
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 3966080 1332040 2412860 36% /
76892 11848320 43% /mnt/ecu/vdd
[xr-vm_node0_RP0_CPU0:~]$
Using python:
I am able to run show commands using Connecthandler .send.command:
from netmiko import ConnectHandler
import subprocess
Network_Device = {"host": "10.111.22.333", "username": "USER123", "password": "Pass123", "device_type": "cisco_xr",}
Connect = ConnectHandler(**Network_Device)
Connect.enable()
version1 = "show version"
print(Connect.send_command(version1))
But not able to run 'df' or 'ls' commands, as not able to reach bash prompt i reach by running 'run' command on router.
I tried:
disk1files = subprocess.run("df", stdout=subprocess.PIPE)
print(disk1files.stdout.decode())
But seems its wrong. Please suggest the right library or code I can use here.
This is my first question here, so bear some silly questions or mistakes done in code
if on DF you are referring to "Don't fragment" then it is posible to send it like
Connect.send_command("ping 192.168.10.10 df-bit size 1600")
where 1600 represents MTU, and for ls commands is link command,
Connect.send_command("ls-active")
Connect.send_command("ls-active-enabled")
but if you are referring to df and ls in linux (disk free and list files..) then you can use os module for sending commands:
import os
os.system("ls -l")
or use call from subprocess module:
from subprocess import call
call(["ls", "-l"])
If you need to acccess cisco bash:
switch# configure terminal
switch(config)# feature bash-shell
switch# run?
run Execute/run program
run-script Run shell scripts
switch# run bash?
bash Linux-bash
switch# run bash
bash-4.2$ whoami
admin
bash-4.2$ pwd
/bootflash/home/admin
bash-4.2$

eclipse CDT esp-idf build but don't flash

Windows10 eclipse esp-idf latest version 2021-03
With the command line idf.py I can build and flash the esp-idf\examples\get-started\blink programme which run on a ESP32.
In eclipse, the buils works but the run command display in console
Usage: C:\Users\peter\esp-idf\tools\idf.py [OPTIONS] COMMAND1 [ARGS]...
[COMMAND2 [ARGS]...]...
ESP-IDF CLI build management tool. For commands that are not known to
idf.py an attempt to execute it as a build system target will be made.
.... bla bla ...
Can anybody tells me what is wrong ?
Regards
There is a bug in the eclipse/esp-idf launch bar.
The ESP target for esp32 is defined with a Serial Port COM3.
But that info is not used.
If one redefine a new ESP Target with the same serial port under a different name, then the run command will work!
See hereafter for the people interested in the details
cmd.exe /C "cd /D C:\Users\peter\esp-idf\components\esptool_py && C:\Users\peter.espressif\tools\cmake\3.16.4\bin\cmake.exe -D IDF_PATH="C:/Users/peter/esp-idf" -D ESPTOOLPY="C:\Users\peter.espressif\python_env\idf4.2_py3.8_env\Scripts\python.exe C:/Users/peter/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32" -D ESPTOOL_ARGS="--before=default_reset --after=hard_reset write_flash #flash_args" -D WORKING_DIRECTORY="C:/Users/peter/eclipse-workspace/blink/build" -P C:/Users/peter/esp-idf/components/esptool_py/run_esptool.cmake"
esptool.py --chip esp32 -p COM3 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x10000 blink.bin
esptool.py v3.0

Nmap wont scan with -oN or -oG

I'm trying to use nmap for port scanning some instances and I would like to have it give me some better looking output. I would like to use the -oG or -oN options, however neither seem to work and using gives me the following output:
user#hostname:~$ nmap -oG 1.2.3.4
Starting Nmap 7.30 ( https://nmap.org ) at 2016-10-14 10:36 PDT
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 0.03 seconds
user#hostname:~$ nmap -oN 1.2.3.4
Starting Nmap 7.30 ( https://nmap.org ) at 2016-10-14 10:36 PDT
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 0.04 seconds
How do I get it to scan my instance with this option?
The output file options (-oN, -oG, -oX, and -oA) all take a filename argument. Your commands are saying, "Generate grepable output and save it to the file called 1.2.3.4." Then Nmap looks at the rest of the line and sees no target specifications (since it assumed 1.2.3.4 was a filename and not an IP address. This command would work instead: nmap -oG myscan.gnmap 1.2.3.4

Segfault on mongodb extension 1.1.2/1.1.3-dev with PHP 7 FPM under gentoo

I am heaving a strange problem under gentoo. Mongodb extension is working fine in apache2 and cli, but fpm fails to start:
/etc/init.d/php-fpm restart
* Testing PHP FastCGI Process Manager configuration ...
[30-Jan-2016 13:59:47] NOTICE: configuration file /etc/php/fpm-php7.0/php-fpm.conf test is successful
zend_mm_heap corrupted [ !! ]
php -v
PHP 7.0.2-pl5-gentoo (cli) (built: Jan 30 2016 13:16:21) ( ZTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
Here is the info from cli:
php -i|grep mongo
mongodb
mongodb support => enabled
mongodb version => 1.1.3-dev
mongodb stability => devel
libmongoc version => 1.3.1-dev
mongodb.debug => no value => no value
I even compiled mongodb without sasl but the result is the same.
Mongodb extension was manually compiled like this(my system is x86_64):
git clone https://github.com/mongodb/mongo-php-driver.git
cd mongo-php-driver; git submodule sync && git submodule update --init
Run phpize:
phpize --clean
phpize
Remove the aclocal.m4 file:
rm aclocal.m4
Run aclocal and autoconf:
aclocal
autoconf
Now configure, make and install the package:
./configure --without-mongodb_sasl (i tried with and without this)
make
make install
add extension=mongodb.so in php.ini: /etc/php/fpm-php7.0/php.ini
restart php-fpm: /etc/init.d/php-fpm restart
The strangest thing is that if i start php-fpm process with gdb to backtrace the extensions works.
gdb -q /usr/lib/php7.0/bin/php-fpm
Reading symbols from /usr/lib/php7.0/bin/php-fpm...(no debugging symbols found)...done.
(gdb) set args --pid /run/php-fpm.pid --fpm-config /etc/php/fpm-php7.0/php-fpm.conf -c /etc/php/fpm-php7.0/
(gdb) run
Starting program: /usr/lib64/php7.0/bin/php-fpm --pid /run/php-fpm.pid --fpm-config /etc/php/fpm-php7.0/php-fpm.conf -c /etc/php/fpm-php7.0/
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[Inferior 1 (process 4075) exited normally]
(gdb)
Any help is apreciated
For the sake of the lazy googler, this is fixed in version 1.1.5 of the php-mongodb-driver

fast scala compiler: Unable to establish connection to compilation daemon

I have a ubuntu machine under OpenVZ virtualization. When I run fsc test.scala I get:
Unable to establish connection to compilation daemon
Then ps aux shows me lots of processes that look like this
ren 17482 0.0 0.0 4908 1400 pts/0 S 00:29 0:00 /bin/bash --posix /usr/bin/scala -Djava.net.preferIPv4Stack=true scala.tools
ren 17490 0.2 0.5 1246676 24268 pts/0 Sl 00:29 0:00 java -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Stack=true -Xbootc
I have run out of ideas how to make it work, version is Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL. Any ideas?
Edit:
Found this, so:
selinux is not installed
export | grep SCALA doesn't return
anything, however scalac and scala compiling/running fine so I assume
this step is ok
ping localhost - works
fsc -reset - same error
fsc -verbose >> logfile.log 2>&1 produces this:
Fast Scala compiler version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
[Given arguments: -verbose]
[Transformed arguments: -verbose -current-dir /home/ren]
[VM arguments: ]
[Temp directory: /tmp/scala-devel/ren]
[Port number: 36737]
java.net.SocketException: Invalid argument or cannot assign requested address
[Connecting to compilation daemon at port 36737 failed; re-trying...]
No compile server running: starting one with args ''
[Executing command: scala scala.tools.nsc.CompileServer -v]
Starting CompileServer on port 34962
Redirect dir is /tmp/scala-devel/ren/output-redirects
[Port number: 34962]
java.net.SocketException: Invalid argument or cannot assign requested address
[Connecting to compilation daemon at port 34962 failed; re-trying...]
[Port number: 34962]
java.net.SocketException: Invalid argument or cannot assign requested address
[Connecting to compilation daemon at port 34962 failed; re-trying...]
No compile server running: starting one with args '' and so on ...
Edit 2:
Well, starting compilation server like this scala scala.tools.nsc.CompileServer -v actually works! And it seems fsc did start all those servers, but for some reason it decided it didn't. fsc -server localhost:port test.scala works. Which is good enough for now.
It seems fsc uses hostname to connect to compilation server. My hostname didn't response to ping. Changing it to localhost in /etc/hostname fixed the problem.