Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 338 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[FASM] Compare 2 strings

#1

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

Reply

#2
Quote:(12-02-2016, 12:39 AM)Jochen Wrote:

[To see links please register here]


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

I would just do:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


^ full manual approach using pointer arithmetic and comparing null-byte with test.

Essentially my approach was to load the address of the string into ecx, load the address of the string offset by 1 into edx (because of the last inc to ecx before the test), compare bytes from ecx register by moving them into lower eax (al) 8-bit segment, then subtract edx (string address + 1) from ecx to get the length. In the case of "", ecx is still incremented, which will match edx+1 to return 0.
Reply

#3
Quote:I would just do:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


^ full manual approach using pointer arithmetic and comparing null-byte with test.

Essentially my approach was to load the address of the string into ecx, load the address of the string offset by 1 into edx (because of the last inc to ecx before the test), compare bytes from ecx register by moving them into lower eax (al) 8-bit segment, then subtract edx (string address + 1) from ecx to get the length. In the case of "", ecx is still incremented, which will match edx+1 to return 0.

Hi bitm0de: Your talking about getting the length of a string ?
For that i use this atm

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

Reply

#4
Quote:(12-05-2016, 10:30 AM)Jochen Wrote:

[To see links please register here]

Quote:I would just do:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


^ full manual approach using pointer arithmetic and comparing null-byte with test.

Essentially my approach was to load the address of the string into ecx, load the address of the string offset by 1 into edx (because of the last inc to ecx before the test), compare bytes from ecx register by moving them into lower eax (al) 8-bit segment, then subtract edx (string address + 1) from ecx to get the length. In the case of "", ecx is still incremented, which will match edx+1 to return 0.

Hi bitm0de: Your talking about getting the length of a string ?
For that i use this atm

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

Ahh yeah. Correct. Change test to a cmp and increment an offset to another memory space for comparison. I don't know why I read this as Strlen rather than Compare... :S This would be the naive version of it though, the actual implementation of strlen() is not so simple, and involves a lot of bitwise arithmetic tricks:

[To see links please register here]


My ASM is very small byte size though too.

You like using all of the special string instructions over doing things manually don't you?
Reply

#5
Quote:You like using all of the special string instructions over doing things manually don't you?

I like to learn new things. I find ASM interesting because you can understand the inner workings of things :smile:
I first started out with Delphi. I would like to learn C/C++. If you want to create big stuff you can't always rely on ASM.
Delphi create big PE files with many sections. I believe you can control that in C/C++ ? (FileSize) etc ..
And i always can use inline ASM under C/C++ to.. BitmOde can you give me a few tips to get started ? What compiler do you use ? Btw i dont like Visual Studio
Reply

#6
Quote:(12-06-2016, 01:09 AM)Jochen Wrote:

[To see links please register here]

Quote:You like using all of the special string instructions over doing things manually don't you?

I like to learn new things. I find ASM interesting because you can understand the inner workings of things :smile:
I first started out with Delphi. I would like to learn C/C++. If you want to create big stuff you can't always rely on ASM.
Delphi create big PE files with many sections. I believe you can control that in C/C++ ? (FileSize) etc ..
And i always can use inline ASM under C/C++ to.. BitmOde can you give me a few tips to get started ? What compiler do you use ? Btw i dont like Visual Studio :smile:

The language has less to do with PE output and it's more compiler based. Saying you can achieve better control over file alignment and section size is not a programming language dependent matter IMO. You can always manipulate the PE after it's gone through compilation.

Visual Studio is an IDE though but if you're on Windows, it would be my suggestion for C++, if you want to do C, then just grab a build of MinGW for gcc.
Reply

#7
Quote:(12-06-2016, 03:53 AM)bitm0de Wrote:

[To see links please register here]

Quote: (12-06-2016, 01:09 AM)Jochen Wrote:

[To see links please register here]

Quote:You like using all of the special string instructions over doing things manually don't you?

I like to learn new things. I find ASM interesting because you can understand the inner workings of things :smile:
I first started out with Delphi. I would like to learn C/C++. If you want to create big stuff you can't always rely on ASM.
Delphi create big PE files with many sections. I believe you can control that in C/C++ ? (FileSize) etc ..
And i always can use inline ASM under C/C++ to.. BitmOde can you give me a few tips to get started ? What compiler do you use ? Btw i dont like Visual Studio :smile:

The language has less to do with PE output and it's more compiler based. Saying you can achieve better control over file alignment and section size is not a programming language dependent matter IMO. You can always manipulate the PE after it's gone through compilation.

Visual Studio is an IDE though but if you're on Windows, it would be my suggestion for C++, if you want to do C, then just grab a build of MinGW for gcc.
Okay thx
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through