Encode and decode an Adobe Dreamweaver password in *.ste file - dreamweaver

How is a password encoded or decoded in order to retrieve a password from an Adobe Dreamweaver *.ste file, or to dynamically create a *.ste file designed to be imported into Dreamweaver?

This Javascript function can be used to encode the password:
function encodePassword(input)
{
var top = 0;
var output = '';
for(var i = 0; i < input.length; i++){
var currentChar = input.charCodeAt(i);
if(currentChar < 0 || currentChar > 0xFFFF){return(false);}
if(top != 0){
if(0xDC00 <= currentChar && currentChar <= 0xDFFF){
output += dec2hex(0x10000 + ((top - 0xD800) << 10) + (currentChar - 0xDC00) + i) + '';
top = 0;
continue;
// Insert alert for below failure
}else{return(false);}
}
if(0xD800 <= currentChar && currentChar <= 0xDBFF){top = currentChar;}
else{output += dec2hex(currentChar + i) + '';}
}
return(output);
}
function dec2hex(input){return(input+0).toString(16).toUpperCase();}
And this function can be used to decode the password:
function decodePassword(input)
{
var output = "";
if(input.length == 0){return("");}
for(var i = 0; i < input.length / 2; i++){
var currentHex = parseInt(input.substr(i * 2, 2), 16);
if(currentHex <= 0xFFFF){
output += String.fromCharCode(currentHex - i);
}else if(currentHex <= 0x10FFFF){
currentHex -= 0x10000
output += String.fromCharCode(0xD800 | (currentHex >> 10)) + String.fromCharCode(0xDC00 | (currentHex & 0x3FF) - i);
}else{
//Insert alert for below failure
return(false);
}
}
return(output);
}
You can also do this online without any code using this tool: http://blog.affirmix.com/2009/05/05/live-ste-dreamweaver-password-encoder-and-decoder/

To decode the Dreamweaver password you break the password into pairs of hexadecimal (0-9, A-F) digits then subtract from each hex digit based on it's position in the string, starting with 0, then convert back to ascii.
The encrypted password of 5470714865787F would be...
54-0 = 54 => T
70-1 = 6F => o
71-2 = 6F => o
48-3 = 45 => E
65-4 = 61 => a
78-5 = 73 => s
7F-6 = 79 => y
So 5470714865787F => 'TooEasy'
We have a working example of this on our website which allows you to decode your password. You can also copy/paste your entire .ste file and it will output the needed FTP details to connect, save some time...
http://www.mywebsitespot.com/dreamweaver-password-decode

Sorry to wake up an old thread but thought I'd post my solution. It's a single HTML5 page that can load and parse Dreamweaver STE files, decoding the password as part of that. I wanted something simple, offline/local (so details aren't transmitted when decoding) that I could to just load an STE file in to and it would give me all the FTP details:
Blog Post:
http://bobmckay.com/web/dreamweaver-password-ste-file-decoder
Decoder Page:
http://bobmckay.com/dreamweaver-password-decoder/
Hope it's useful to someone!
Bob

Waking an old thread, but in addition to the accepted JavaScript answer, I just wanted to leave two PHP functions for anyone interested:
To encode a password:
function dwste_encode( $pw ){
$output = '';
$split = str_split( $pw );
foreach( $split as $key => $value ){
$char = ord( $value );
$char = ( $char + $key );
$char = dechex( $char );
$output .= strtoupper( $char );
}
return $output;
}
To decode a password:
function dwste_decode( $pw ){
$output = '';
$split = str_split( $pw, 2 );
foreach( $split as $key => $value ){
$char = hexdec( $value );
$char = ( $char - $key );
$char = chr( $char );
$output .= $char;
}
return $output;
}

I needed to create many DW ste files for a client today. I used the following VBA to do it straight from Excel. I used the code from #andrew-odri as the basis.
Function decodeDreamWeaverPass(sHash$)
Dim sPass$, i&, lHash&, lChar&, sChars$
lHash = Len(sHash) - 1
For i = 0 To lHash Step 2
sChars = Mid(sHash, i + 1, 2)
lChar = CLng("&H" & sChars)
lChar = lChar - (i / 2)
sPass = sPass & Chr(CLng(lChar))
Next
decodeDreamWeaverPass = sPass
End Function
Function encodeDreamWeaverPass(sPassword$)
Dim lTop&, i&, sOutput$
Dim lPassword&, sChar$, lChar&
lTop = 0
lPassword = Len(sPassword) - 1
For i = 0 To lPassword
lChar = Asc(Mid(sPassword, i + 1, 1))
sChar = Chr(lChar)
If ((lChar < 0) Or (lChar > 65535)) Then
encodeDreamWeaverPass = ""
End If
If lTop > 0 Then
If (lChar >= 56320) And (lChar <= 57343) Then
sOutput = sOutput & Hex(65536 + ((lTop - 55296) Xor 10) + (lChar - 56320) + i)
lTop = 0
Else
encodeDreamWeaverPass = ""
End If
End If
If (lChar >= 55296) And (lChar <= 56319) Then
lTop = lChar
Else
sOutput = sOutput & Hex(lChar + i)
End If
Next
encodeDreamWeaverPass = sOutput
End Function

Related

How do I print a shuffled order of strings that never repeat? ARDUINO

I'm trying to make a scramble generator for the rubik's cube, every letter corresponds to a move on the cube, but I don't want that two moves get printed next to each other, for example " R R U U2 L' " because that would make quite inefficient that scramble. I'll paste part of the code down below:
char a0[] = "R ";
char a1[] = "L' ";
char a2[] = "B' ";
char a3[] = "D2 ";
char a4[] = "F ";
char a5[] = "U2 ";
int moveA;
for (int i=0; i < 6; i++)
{
moveA = random(0,5);
if (moveA == 0)
Serial.print(a0);
else if (moveA == 1)
Serial.print(a1);
else if (moveA == 2)
Serial.print(a2);
else if (moveA == 3)
Serial.print(a3);
else if (moveA == 4)
Serial.print(a4);
else if (moveA == 5)
Serial.print(a5);
delay(200);
The output is usually something like
B' F D2 D2 R B'
F2 D' D' F2 R2 R2
You can put the moves in an array and then shuffle the array:
const char *moves[] = {"R ", "L' ", "B' ", "D2 ", "F ", "U2 "};
const int num_moves = sizeof(moves) / sizeof(moves[0]);
// Shuffle
for (int i = num_moves - 1; i > 0; i--)
{
// Random index 0 ≤ j ≤ i
int j = random(0, i + 1);
// Swap
const char *tmp = moves[i];
moves[i] = moves[j];
moves[j] = tmp;
}
for (int i = 0; i < num_moves; i++)
{
Serial.print(moves[i]);
delay(200);
}
See: Fisher–Yates shuffle

What is causing the unexpected token "=" within a for loop in my Groovy script?

I have been trying to customize the code from this site to convert the tables in an excel workbook to csv files. I've made a few small modifications above segment in question, and have only added a label to that segment as it was throwing a different error otherwise. I now get an unexpected token error on the first "=" in my for loop:
.groovy: 21: unexpected token: = # line 21, column 16.
for (int r = 0, rn = sheet.getLastRowNum() ; r <= rn ; r++) {
^
1 error
The entire script is included below. I've tried retyping the code to find any syntax errors but I fear it might just be a misunderstanding on my part of the way groovy interprets this code.
#!/usr/bin/env groovy
#Grab(group='org.apache.poi', module='poi', version='4.1.0')
import org.apache.poi.xssf.usermodel.XSSFWorkbook
import org.apache.poi.ss.usermodel.DataFormatter
Workbook wb = new XSSFWorkbook(new File(this.args));
int sheetNo = Integer.parseInt(args[index++]);
FormulaEvaluator fe = null;
if ( index < args.length ) {
fe = wb.getCreationHelper().createFormulaEvaluator();
}
DataFormatter formatter = new DataFormatter();
PrintStream out = new PrintStream(new FileOutputStream(csvFile), true, "UTF-8");
byte[] bom = [(byte)0xEF, (byte)0xBB, (byte)0xBF];
out.write(bom);
label:{
Sheet sheet = wb.getSheetAt(sheetNo);
for (int r = 0, rn = sheet.getLastRowNum() ; r <= rn ; r++) {
Row row = sheet.getRow(r);
if ( row == null ) { out.println(','); continue; }
boolean firstCell = true;
for (int c = 0, cn = row.getLastCellNum() ; c < cn ; c++) {
Cell cell = row.getCell(c, Row.MissingCellPolicy.RETURN_BLANK_AS_NULL);
if ( ! firstCell ) out.print(',');
if ( cell != null ) {
if ( fe != null ) cell = fe.evaluateInCell(cell);
String value = formatter.formatCellValue(cell);
if ( cell.getCellTypeEnum() == CellType.FORMULA ) {
value = "=" + value;
}
out.print(encodeValue(value));
}
firstCell = false;
}
out.println();
}
}
just split it on two statements:
int cn = row.getLastCellNum()
for (int c = 0 ; c < cn ; c++) {
...

I tried with String Split with Varying number of elements in each row of data. I am not able to trace NULL at the end

Trying to read from a data file with number of rows of data and each row the number of elements are varying.
StreamReader read = new StreamReader("TextFile1.txt");
string str1 = " ";
while (str1 != null)
{
str1 = read.ReadLine();
if (str1 != null)
{
richTextBox1.AppendText("\n"+str1);
string[] s = str1.Split(' ');
i = 0;
sum = 0;
while (s[i] != null)
{
if(i>0)
j=int.Parse(s[i]);
sum = sum + j;
i = i + 1;
}
}
}
Presuming the code you posted is C#, you should use the String.length property.
Just a snippet of that from the inside of your loop:
string[] s = str1.Split(' ');
i = 0;
sum = 0;
while (i < s.length)
{
j=int.Parse(s[i]);
sum = sum + j;
i = i + 1;
}
By the way, I removed the if(i > 0) condition as it seems rather unnecessary. However, if you would like to exclude the first element on the line (which is what the if(i>0) condition was doing), then simply change i = 0; to i = 1;.

gryo scope and accelerometer output

I am currently working on project using and arduino, a gyro, an accelerometer, and a Bluetooth chip to try to model some data. I am currently trying to gather data, package it up and send it to a phone via Bluetooth. The issue is the Bluetooth chip I am using is a low energy one and so it can only send messages of 20 bytes at a time. I am trying to get past this issue by storing the data collected for a certain amount of time then send it all in 20 byte bursts. I am currently testing this method without sending the data and just printing the data to the serial monitor. This is where my issue is arising, when printing the data in real time everything works but when I try to store it in an array I get this:
593,575,567,0,0,0
592,575,567,0,0,0
592,575,567,0,0,0
592,575,567,0,0,0
592,575,567,0,0,0
593,575,567,0,0,0
586,576,568,0,0,0
0,0,0
0,0
0,0
,0,0,0
0,0,0
As you can see it seems to just break. If anyone could help me out it would be great!
Here is the relevant code chunk
for(int i = 0; i < loopVal; i++)
{
yawGyroValDouble = 0;
pitchGyroValDouble = 0;
rollGyroValDouble = 0;
totalClicksY = 0;
angleY = 0;
totalClicksP = 0;
angleP = 0;
totalClicksR = 0;
angleR = 0;
xRe = 0;
yRe = 0;
zRe = 0;
s = "";
int starttime = millis(); // get start time
int endtime = starttime; // init end time
while ((endtime - starttime) < time)
{
getGyroValues(); // This will update rollGyroVal, pitchGyroVal, and yawGyroVal with new values
yawGyroValDouble =yawGyroVal;
if(abs(yawGyroValDouble) > abs(gyroNoiseThresh)){ // ignore noise
totalClicksY+=yawGyroValDouble; // update runsum
}
pitchGyroValDouble =pitchGyroVal;
if(abs(yawGyroValDouble) > abs(gyroNoiseThresh)){ // ignore noise
totalClicksP+=pitchGyroValDouble; // update runsum
}
rollGyroValDouble =rollGyroVal;
if(abs(yawGyroValDouble) > abs(gyroNoiseThresh)){ // ignore noise
totalClicksR+=rollGyroValDouble; // update runsum
}
xRe = analogRead(pinX);
yRe = analogRead(pinY);
zRe = analogRead(pinZ);
delay (gyroDelayTime);
endtime = millis();
}
angleY = totalClicksY / clicksPerDegCCW;
angleP = totalClicksP / clicksPerDegCCW;
angleR = totalClicksR / clicksPerDegCCW;
String yawSend = String(angleY);
String pitchSend = String(angleP);
String rollSend = String(angleR);
String xSend = String(xRe);
String ySend = String(yRe);
String zSend = String(zRe);
//s = "Accel - X: " + xSend + " Y: " + ySend + " Z: " + zSend + "\n" + "Gyro - Yaw: " + yawSend + " Pitch: " + pitchSend + " Roll: " + rollSend;
s = "" + xSend + "," + ySend + "," + zSend + "," + yawSend + "," + pitchSend + "," + rollSend;
Serial.println(s);
res[i] = s;
}
You didn't show where totalClicksY, totalClicksP, totalClicksR, and clicksPerDegCCW are declared, but I'm betting they are declared as integer types (int or long). If so, the result of your maths:
angleY = totalClicksY / clicksPerDegCCW;
angleP = totalClicksP / clicksPerDegCCW;
angleR = totalClicksR / clicksPerDegCCW;
will be integers. And if the results of those divisions are less than 1, they will be truncated to 0.
Try declaring totalClicksY, totalClicksP, totalClicksR and clicksPerDegCCW as double. That, or cast them when you do the math, like this:
angleY = (double)totalClicksY / (double)clicksPerDegCCW;
angleP = (double)totalClicksP / (double)clicksPerDegCCW;
angleR = (double)totalClicksR / (double)clicksPerDegCCW;
(I'm also assuming that angleY, angleP, and angleR are also declared as doubles - if not they definitely should be).

adding strings as numbers

I'm trying to add together two large numbers, stored as strings.
Here's what I have so far:
function addBigNums(a,b){
c = ""; // output
o = 0; // carryover
startLen = a.length-1;
for(i = startLen; i >= 0; i--) {
sum = parseInt(a[i], 10) + parseInt(b[i], 10) + o;
c = (sum % 10) + c;
o = sum >= 10;
}
if(o === true) c = "1" + c;
return c;
}
I'm running into two issues:
1 ) my carry is not always functioning properly, primarily when:
2 ) the numbers length differ.
Right now I think I would have to prepend 0's onto the shorter number in order to get this to function as expected.
Any better alternatives to this?
Simple, straightforward integer addition like you would do it manually:
a = "123456"; // input a
b = "123456"; // input b
c = ""; // target-string
o = 0; // overflow-bit
// traverse string from right to left
for(i = a.length - 1; i >= 0; i--) {
// do the calculation (with overflow bit)
sum = parseInt(a[i]) + parseInt(b[i]) + o;
// prepend resulting digit to target
c = (sum % 10) + c;
// set overflow bit for next round
o = sum >= 10;
}
// prepend another "1" if last overflow-bit is true
if(o == true) c = "1" + c;
If strings a and b are not equal length (but you stated that they are), you should prepend the shorter string with zeros before calculation.
Consider both numbers to be an array of digits. Add them up right-to-left handling overflow flag. Demo. Assuming your numbers are of the same length
function getNumber(len) {
return Array.apply(null, new Array(len)).map(function(){
return Math.floor(Math.random()*9);
}).join('');
}
var len = 600,
a = getNumber(len), //use your numbers here
b = getNumber(len),
flag = 0;
var c = [].reduceRight.call(a, function(acc, val, idx) {
val = +val + (+b.charAt(idx)) + flag;
flag = val / 10 | 0;
val %= 10;
return val + acc;
}, '');
c = (flag ? 1: '') + c;
console.log(a, b, c);

Resources