Everything worked well, until I realized that the specific webserver I was writing code for ran PHP 4…No mcrypt_decrypt.
Hence I discovered PHPSecLib has the Rijndael algorithm implemented as PHP code. Following please find code to check if mcrypt exists and react differently (where $line is the encrypted text):
This specific content was written 14 years ago.
Please keep this in mind as it may be outdated and not adhering to best-practices.
Hey,
Small post outlining a small modification to the 0.4 lightcouch source to allow direct plain text json insertion. A colleague and I had a JSON string which we wanted to insert into lightcouch without having to create a JSON object – only to have .toString() be called during the final POST request.
This specific content was written 14 years ago.
Please keep this in mind as it may be outdated and not adhering to best-practices.
Introduction
In this post we analyze the following command which allows you to run “top interactively without having to look up the pids” your interested in.
top -p `pgrep process-name | tr "\\n" "," | sed 's/,$//'`
Analysis
The command is split into multiple sub commands.
top:displays running processes. With -p option means monitor specific process IDs.
pgrep: Looks through the currently running processes and lists the process IDs which matches the selection criteria (proccess-name).
pipe (|): The pipe operator. It is used to direct the stdout of the first command to the stdin of the second command.
tr (translate): Is used for replacing or removing specific characters in its input data set. Above: linefeed(\n) is replaced with comma(,) .
sed: sed is used to remove the last comma(,) for the list. Sed is a stream editor which are used to perform basic text transformations on an input stream (a file or input from a pipeline). sed‘s ability to filter text in a pipeline particularly distinguishes it from other types of editors.
This specific content was written 14 years ago.
Please keep this in mind as it may be outdated and not adhering to best-practices.
This is a quick post about creating dispatching events using javascript and specifically key press events (for use with greesemonkey or whatnot and firefox).
Note that this will not work for the latest versions of firefox in many instances. I believe this is due to security updates.
Personally I am using this dispatch keypresses to google docs from a greesemonkey script.
Below the code for typing “hello world” to google docs from a greesemonkey user script.
I suspect there may be a more efficient ways though I noticed not all browsers support the same API 🙁 . Specifically, on http://help.dottoro.com/ljbwbehw.php we see that initKeyEvent is only available in firefox. On the other hand, initTextEventis available in IE, chrome, and Safari.
This specific content was written 14 years ago.
Please keep this in mind as it may be outdated and not adhering to best-practices.
I Wanted to do some maintenance and move my couchdb data files to another partition but couchdb would not stop when I called the usual stop commands:
1)sudo /etc/init.d/couchdb stop
2)sudo service couchdb stop
Found a lot of posts and out of all of them found this nice tidbit below:
ps -U couchdb -o pid= | xargs kill -9
Note: It’s not the best thing to viciously kill a process. I imagine databases usually have shutdown tasks to do, must end with current insertions, etc. I’ll post if I find a bug fix.
This specific content was written 14 years ago.
Please keep this in mind as it may be outdated and not adhering to best-practices.
Excel VBA
Description:
This is a sample script showing how I pull web-banking balances off the internet when I want to have a total picture of how my finances are. For the boring reasoning go to the last page. Otherwise technical details follow.
Project References:
Add the following to the references for this to work:
-Microsoft HTML Object Library
-Microsoft Internet Controls
VBA references
Code:
The code below is an example of how to do this missing error handling. As it uses IE, it saves the developer the task of implementing SSL in VBA.
Navigating the Site
Public oBrowser As InternetExplorer
Sub Login_2_Website()
Dim oHTML_Element As IHTMLElement
Dim sURL As String
Dim text As String
Dim avarSplit As Variant
sURL = "https://secure.alpha.gr/e-services"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.navigate sURL
oBrowser.Visible = True
Do
' Wait till the Browser is loaded'
Loop Until oBrowser.readyState = READYSTATE_COMPLETE
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_NewLayoutSignOn__userName").Value = "USER"
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_NewLayoutSignOn__Pswd").Value = "PASSWORD"
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_NewLayoutSignOn__login").Click
Do
' Wait till the Browser is loaded'
Application.Wait DateAdd("s", 0.1, Now)
Debug.Print (oBrowser.document.readyState)
Debug.Print (oBrowser.LocationURL)
Loop Until oBrowser.document.readyState = "complete"
oBrowser.navigate "https://secure.alpha.gr/e-services/AWBPage.aspx?service=balancesStatements"
Do
' Wait till the Browser is loaded'
Application.Wait DateAdd("s", 2, Now)
Debug.Print (oBrowser.readyState)
Debug.Print (oBrowser.LocationURL)
Loop Until oBrowser.document.readyState = "complete"
Application.Wait DateAdd("s", 2, Now)
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_balancesStatements__productsPagedDropDownList__selectionList").selectedIndex = 1
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_balancesStatements__productsPagedDropDownList__selectedIndexHiddenField").Value = "1"
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_balancesStatements__balancesButton").Click
Do
' Wait till the Browser is loaded'
Application.Wait DateAdd("s", 0.1, Now)
Debug.Print (oBrowser.document.readyState)
Debug.Print (oBrowser.LocationURL)
Loop Until oBrowser.document.readyState = "complete"
getBalance
End Sub
This specific content was written 14 years ago.
Please keep this in mind as it may be outdated and not adhering to best-practices.
Dear All,
Quick little post about a small script I made for backing up some files from a webserver (hosting apache+mysql).
I wanted a script which would remind me to backup whenever I would log onto the specific machine.
I would have preferred automated but I’m a little paranoid about security. Why?
I don’t want to automatically compromise the security of a public webserver if another computer is hacked…so even if the backup server is hijacked no certificate/password will be stored.
Hence running the backup script required an actual user to type in the password.
This blog is related to topics about operating systems, development, coding, and software and
contains our own opinions, code, and examples unless otherwise stated.
It is also a work in progress - so bear with us as we improve the template and content.
Sep 6 2012
Encrypt in VB.NET and Decrypt in PHP 4 Using Phpseclib0.3.0
Originally I had found code from: Encrypt in VB.NET and Decrypt in PHP and Vice Versa .
Everything worked well, until I realized that the specific webserver I was writing code for ran PHP 4…No mcrypt_decrypt.
Hence I discovered PHPSecLib has the Rijndael algorithm implemented as PHP code.
Following please find code to check if mcrypt exists and react differently (where $line is the encrypted text):
if(function_exists('mcrypt_decrypt'))
$dec = decryptRJ256($ky, $iv, $line);
else
$dec = decryptRJ256_PHPSECLIB($ky, $iv, $line);
By Menelaos Bakopoulos • Encryption, PHP, Programming, Scripts 3