GNU Mailutils: How to encode a '*' in a password - urlencode

I am trying to access a remote mailbox using mailutils message command. The password contains a '*' character. No matter whether I use this character straight or percent encoded I always get an authentication error.
Contents of mailutils-test.cfg
mailbox {
mailbox-pattern "imap://userjoe:secret*pwd#imap.mydomain.de/INBOX";
}
or
mailbox {
mailbox-pattern "imap://userjoe:secret%2Apwd#imap.mydomain.de/INBOX";
}
Command used from a linux bash
messages --config-file=/srv/www/htdocs/mailutils-test.cfg --config-verbose --debug-level=auth.trace9
How can I fix this? I read the doc but could not find any advice on this problem.

Related

John The Ripper 'No password hashes loaded'(see FAQ)

I am trying to learn John. I've been through the FAQ and this tutorial, but am stuck.
I have made a RAR4 password hash. It's super simple. The password is 'test'. I now want to use a tool to crack it.
I've saved it to a file "test.txt".It has:
Red dead redemption.rar:$RAR3$*1*de613099dc859cfd*00000000*16*0*1*b52125c28c4fc60a1c00f313d0fb68ca*33:1::Red dead redemption.torrent
When running the following command, I get 'No password hashes loaded'
What should I do to get this working please?
Command: john.exe test.txt
$$ in your hash specify that they are encrypted with yescrypt, Hence you need to specify format to the john
john.exe --format=crypt test.txt
This should work

Special character (!, exclamation mark) in DB2 user password gives error when starting i2 Analyze or connecting from DB2 command console

The following error occurs when starting i2 Analyze with example deployment
(some parts of error messages are in Finnish because of the Windows localization settings, sorry about that)
setup -t startLiberty
java.sql.SQLInvalidAuthorizationSpecException: [jcc][t4][2013][11249][4.17.29] On ilmennyt yhteyden käyttöoikeusvirhe. Syy: Käyttäjätunnus tai tunnussana ei kelpaa. ERRORCODE=-4214, SQLSTATE=28000 DSRA0010E: SQL State = 28000, Error Code = -4 214
I believe the error is more closely related to DB2(10.5 FP7) & Windows(W12R2) than i2 Analyze itself because when connecting from DB2 command console (db2cmd) and giving both username and password (with !) within a single line:
connect to WRITESTORE user db2admin using <SomePasswordWith!>
The error shown in console is as follows:
SQL0104N Järjestelmä on löytänyt merkkijonoa "<tunnus>" seuraavan
tunnistamattoman sanakkeen "!". Odotettuja sanakkeita ovat esimerkiksi
seuraavat: "NEW". SQLSTATE=42601
Anyhow, if password (with character !) is given only when prompted eg:
connect to WRITESTORE user db2admin
and giving password when asked, user is logged in without an error.
Also when connecting to DB2 with IBM DataStudio gives no error.
So, using passwords without special characters is a workaround for the issue.
http://www-01.ibm.com/support/docview.wss?uid=swg21303153
Username/password with special characters need to be quoted when using them through CLP within db2prompt
Lainausmerkkeihin :)
connect to WRITESTORE user db2admin using '<SomePasswordWith!>'

sqlTool.rc contais password in plain text

I want to stop my HSQL DB from command line using command
java -jar hsqldb/lib/sqltool.jar --rcfile=sqltool.rc --sql "shutdown;" localhost-sa-myPassword
This command expects sqlTool.rc file which contains DB related information like user id and password. This RC file contains password in plain text.
Is there any way to hide that password in RC file?
Or is there any way to encrypt this RC file and use it?
Or is it possible to forcibly stop the server without giving id/pwd?
Any other approach is also welcome as long as password is not visible in plain text
Thanks in advance
I got alternative approach for this.
Connection c = DriverManager.getConnection(
"jdbc:hsqldb:file:/opt/db/testdb;shutdown=true", "SA", "");
create the connection as mentioned above.
Then execute sql query as given below
stmt.execute("shutdown");
This will shutdown the HSQL DB

connecting to switch via ssh using expect

I'm trying to run an script to connect to a Procurve 4204vl switch using expect.
This is the code I created:
#!/usr/bin/expect -f
set timeout 20
spawn ssh -l user 192.168.0.10
expect "user#192.168.0.10's password:"
send "1234"
send "\r"
expect "Press any key to continue"
send "j\r"
send "conf"
send "\r"
send "no ip route 89.19.238.2 255.255.255.255 192.168.0.12"
send "\r"
send "exit"
send "\r"
send "exit"
send "\r"
send "exit"
send "\r"
expect "Do you want to log out [y/n]?"
send "y"
I run this using simply expect script.exp, and the problem is I got these errors:
the route is not deleted
I got the following error on screen after the script execution is finished:
Press any key to continue invalid command name "y/n"
while executing
"y/n"
invoked from within
"expect "Do you want to log out [y/n]?""
(file "script.exp" line 19)
So, how could I solve this problem?
Thank you.
PS: if I comment all the "exit" lines and also the log out question, then add a last line with the "interact" command, the script works fine.
For route not deleted, what output is the program giving you? Do you see any errors from the router?
In expect and Tcl the square brackets are the syntax to execute a command, quite like backticks in the shell. The simplest solution is to use braces instead of double quotes to prevent command interpolation:
expect {Do you want to log out [y/n]?}
Braces act like single quotes in the shell.
send "logout\r"
expect {
"Do you want to log out" {
send "yy"
exp_continue
} "Do you want to save current configuration" {
set result $expect_out(0,string);
puts "save..."
send "y"
puts "ok"
} eof {
puts "end of script"
}
}
What it worked for me is to use regex (-re argument) and avoid using the characters [] in the expression:
expect -re "Do you want to log out"
It's also useful because if the output from the command is too long or dynamic, using static expression is limited.

proc_open interaction

Here's what I'm trying to achieve: open a shell (korn or bash, doesn't matter), from that shell, I want to open a ssh connection (ssh user#host). At some point it is likely to happen I will be prompted for either a password or I might be asked whether or not I'm sure I want to connect (offending keys).
Before anyone asks: yes, I am aware there is a plugin for ssh2 exec calls, but the servers I'm working on don't support it, and are unlikely to do so.
Here's what I've tried so far:
$desc = array(array('pipe','r'),array('pipe','w'));//used in all example code
$p = proc_open('ssh user#host',$desc,$pipes);
if(!is_resource($p)){ die('#!#$%');}//will omit this line from now on
sleep(1);//omitting this,too but it's there every time I need it
Then I tried to read console output (stream_get_contents($pipes[1])) to see what I have to pass next (either password, yes or return 'connection failed: '.stream_get_contents($pipes[1]) and proc_close $p.
This gave me the following error:
Pseudo-terminal will not be allocated because stdin is not a terminal.
So, I though ssh was called in the php:// io-stream context, seems a plausible explanation of the above error.
Next: I though about my first SO question and decided it might be a good idea to open a bash/ksh shell first:
$p = proc_open('bash',$desc,$pipes);
And take it from there, but I got the exact same error message, only this time, the script stopped running but ssh did run. So I got hopeful, then felt stupid and, eventually, desperate:
$p=proc_open('bash && ssh user#host',$desc,$pipes);
After a few seconds wait, I got the following error:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 133693440 bytes)
The Call Stack keeps bringing up the stream_get_contents line, even in my last desperate attempt:
#!/path/to/bin/php -n
<?php
$p = proc_open('bash && ssh user#host',array(array('pipe','r'),array('pipe','w')),$ps);
if (!is_resource($p))
{
die('FFS');
}
usleep(10);
fwrite($ps[0],'yes'."\n");
fflush($ps[0]);
usleep(20);
fwrite($ps[0],'password'."\n");
fflush($ps[0]);
usleep(20);
fwrite($ps[0],'whoami'."\n");
fflush($ps[0]);
usleep(2);
$msg = stream_get_contents($ps[1]);
fwrite($ps[0],'exit'."\n");
fclose($ps[0]);
fclose($ps[1]);
proc_close($p);
?>
I know, its a mess, a lot of fflush and redundancy, but the point is: I know this connection will first prompt me for offending keys, and then ask a password. My guess is the stream in $pipes[1] holds the ssh connection, hence it's content is huge. what I need then, is a pipe inside a pipe... is this even possible? I must be missing something, what good is a pipe if this isn't possible...
My guess is the proc_open command is wrong to begin with, (error: Broken pipe). But I really can't see any other way around the first error... any thoughts? Or follow up questions if the above rant isn't at all clear (which it probably isn't).
Before anyone asks: yes, I am aware there is a plugin for ssh2 exec
calls, but the servers I'm working on don't support it, and are
unlikely to do so.
There are actually two. The PECL module, which is a PITA that most servers don't have installed anyway and phpseclib, a pure PHP SSH2 implementation. An example of its use:
<?php
include('Net/SSH2.php');
$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
exit('Login Failed');
}
echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
?>