Tuesday, 29 September 2020

PeopleSoft Posting issues

 

Please find the SQL for bulk reposting content.

 

BEGIN

FOR x in  (

       SELECT prcsinstance

       FROM   psprcsrqst

       WHERE  diststatus = 4 -- Those are not posted

       AND    runstatus in (9,10,17)  -- 9 successful processes,17 FOR WARNING,10 FOR NO SUCCESS

       )

LOOP

UPDATE PSPRCSRQST

SET    DISTSTATUS = '7'

WHERE  PRCSINSTANCE = x.prcsinstance;

 

UPDATE PSPRCSQUE

SET    DISTSTATUS = '7'

WHERE  PRCSINSTANCE = x.prcsinstance;

 

UPDATE PS_CDM_LIST

SET    DISTSTATUS   = '8'

,      TRANSFERINSTANCE = 0

WHERE  PRCSINSTANCE = x.prcsinstance

AND    DISTSTATUS   <> '5'; --posted

END LOOP;

END;

/

COMMIT

/

Saturday, 6 June 2020

PHP SSH RSA


Generate Public / Private Key

<?php
include('Crypt/RSA.php');
$rsa = new Crypt_RSA();
//$rsa->setPrivateKeyFormat(CRYPT_RSA_PRIVATE_FORMAT_PKCS1);
$rsa->setPublicKeyFormat(CRYPT_RSA_PUBLIC_FORMAT_OPENSSH);
$rsa->createKey(2048);
extract($rsa->createKey()); // == $rsa->createKey(1024) where 1024 is the key size
echo "<pre>";
echo $privatekey;
echo "<br>";
echo "\n\n\n";
echo $publickey;
echo "</pre>";
?>

// psadmin (.ssh) Folder

[psadmin@localhost ~]$ ls -la
drwx------. 3 psadmin psadmin    44 Jun  6 23:06  .ssh

[psadmin@localhost ~]$ ls -la .ssh
drwx------. 3 psadmin psadmin  44 Jun  6 23:06 .
drwx------. 6 psadmin psadmin 198 Jun  6 22:54 ..
-rw-------  1 psadmin psadmin 237 Jun  6 22:54 authorized_keys


Type 1:

<?php
include('Net/SSH2.php');
include('Crypt/RSA.php');

$ssh = new Net_SSH2('192.168.0.14');
$key = new Crypt_RSA();
$key->loadKey(file_get_contents('C:/xampp/htdocs/ssh/ssh-privatekey.txt'));
if (!$ssh->login('psadmin', $key)) {
    exit('Login Failed');
}
echo "<pre>";
echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
echo "</pre>";
?>

Type 2: using ssh2 in XAMPP

<?php
$connection = ssh2_connect('192.168.0.14', 22, array('hostkey'=>'ssh-rsa'));

if (ssh2_auth_pubkey_file($connection, 'psadmin',
                          'C:/xampp/htdocs/ssh/ssh-publickey.txt',
                          'C:/xampp/htdocs/ssh/ssh-privatekey.txt', NULL)) {
  echo "Public Key Authentication Successful\n";
} else {
  die('Public Key Authentication Failed');
}

$stream = ssh2_exec($connection, 'ls -ltar');
stream_set_blocking($stream,TRUE);
$stream_out = ssh2_fetch_stream($stream,SSH2_STREAM_STDIO);
echo '<pre>';
echo stream_get_contents($stream_out);
echo '</pre>';
?>

Thanks
Zafrulla Khan