I there is anyway to char in FB

General FreeBASIC programming questions.
Post Reply
HACK3R ADI
Posts: 27
Joined: Jun 17, 2012 10:16

I there is anyway to char in FB

Post by HACK3R ADI »

like in C/C++ we declare charatcer like this:

char myvariable

Is there is anyway to declare char in FB
Richard
Posts: 3096
Joined: Jan 15, 2007 20:44
Location: Australia

Re: I there is anyway to char in FB

Post by Richard »

Code: Select all

Dim as Ubyte  an_8_bit_unsigned_integer
Dim as String  a_string_of_ASCII_characters 
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: I there is anyway to char in FB

Post by TJF »

char in C/C++ is a type that may be signed or unsigned and may contain a variable number of bits (8 bit is common).

There're different ways to handle it in FB. As Richard mentioned UBYTE is one solution, but also BYTE.

In case of string variables the FB type STRING is not realy a replacement for char because a STRING may contain zero bytes. It's better to use the FB type named ZSTRING PTR as a replacement for char * or ZSTRING*x for char[x]. Check the Wiki for ZSTRING.
HACK3R ADI
Posts: 27
Joined: Jun 17, 2012 10:16

Re: I there is anyway to char in FB

Post by HACK3R ADI »

I want to store shellcode in C I do thsi like
char myshellcode =
"\x31\xc0\x31\xdb\xb0\x17\xcd\x80\xb0\x2e\xcd\x80"

now is there is any way for it.
Richard
Posts: 3096
Joined: Jan 15, 2007 20:44
Location: Australia

Re: I there is anyway to char in FB

Post by Richard »

Try

Code: Select all

Dim As String myshellcode = Chr(&h31,&hc0,&h31,&hdb,&hb0,&h17,&hcd,&h80,&hb0,&h2e,&hcd,&h80)
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: I there is anyway to char in FB

Post by TJF »

Code: Select all

VAR myshellcode = @!"\&h31\&hc0\&h31\&hdb\&hb0\&h17\&hcd\&h80\&hb0\&h2e\&hcd\&h80"
' or:
' DIM AS ZSTRING PTR myshellcode = @!"\&h31\&hc0\&h31\&hdb\&hb0\&h17\&hcd\&h80\&hb0\&h2e\&hcd\&h80"

?*myshellcode
This way it's much easier to handle non-escaped string part (those without a '\...' before = normal text). You needn't search the codes for CHR, especially when you use complex character encoding like UTF-8.
HACK3R ADI
Posts: 27
Joined: Jun 17, 2012 10:16

Re: I there is anyway to char in FB

Post by HACK3R ADI »

why Rich and you change x to &h
codeFoil
Posts: 256
Joined: Dec 22, 2011 4:45
Location: United States
Contact:

Re: I there is anyway to char in FB

Post by codeFoil »

HACK3R ADI wrote:why Rich and you change x to &h
&h is the convention in BASIC for specifying hexadecimal notation.
fxm
Moderator
Posts: 12577
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: I there is anyway to char in FB

Post by fxm »

See documentation:

- Operator ! (Escaped String)

- Escape Sequences In String Literals
\&hnn: ascii char in hex

There are many answers to our questions in the documentation.
Do not hesitate to study it with full attention.
HACK3R ADI
Posts: 27
Joined: Jun 17, 2012 10:16

Re: I there is anyway to char in FB

Post by HACK3R ADI »

Suppose I want to insetr a big code which requires6 lines

then i will type like this:

Var shellcode = _
"shell code..."
"shell code..."
"shell code..."
"shell code..."
"shell code..."
"shell code..."
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: I there is anyway to char in FB

Post by TJF »

Code: Select all

VAR shellcode = @_
  !"shell code..." _
  !"shell code..." _
  !"shell code..." _
  !"shell code..." _
  !"shell code..." _
  !"shell code..."
HACK3R ADI
Posts: 27
Joined: Jun 17, 2012 10:16

Re: I there is anyway to char in FB

Post by HACK3R ADI »

thank you TJF but can I kn0w what is a use of @ and ! charactaers but anyway.....thanks
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: I there is anyway to char in FB

Post by TJF »

Here I send some punctuation characters ",,,,, ;; :: ...." and some capital letters "QAYXSWEDCVFRTGBNHZUJMKIOLP". Use them in further posts, please. (Some of the forum members aren't native speakers.)
HACK3R ADI wrote:... what is a use of ... ! ...
Find the answer here:
fxm wrote:See documentation:

- Operator ! (Escaped String)

...

There are many answers to our questions in the documentation.
Do not hesitate to study it with full attention.
and
HACK3R ADI wrote:... what is a use of @ ...
Operator @ (Address of)

I feel like repeating it: do not hesitate to search and study the Wiki pages with full attention!
Gonzo
Posts: 722
Joined: Dec 11, 2005 22:46

Re: I there is anyway to char in FB

Post by Gonzo »

at least make sure you insert random trash code into memory (and not use)
encrypt and decrypt your important data in realtime only!
code on a computer disconnected from internet, and test on LAN only
and use the gcc version of the compiler, since FB is a small community finding you is so easy, even my grandmother could figure it out
dont use "special code", the code must be so generic, that when decompiled, it looks like anyone made it (this is primarily why using fbc is a bad idea)

we're not in 2004 anymore when people could "investigate" what they wanted...
everyone is conscious about cyber security now, and noone cares if you never stole a penny (or a password for that matter)

and no, i wont help you beyond this, except if its only for programmatical help :)
except perhaps, dont overdo it :P really, the only good hackers are the ones noone ever knew or heard about
posting shellcode on here was a bad idea to begin with..
its easy to catch it using a web crawler (which i know lots and lots about), so removing it now would be a good start
HACK3R ADI
Posts: 27
Joined: Jun 17, 2012 10:16

Re: I there is anyway to char in FB

Post by HACK3R ADI »

I have posted shell code here because others can understand what I want to say and I understand what you are saying and yes you are right are u also a Hacker?
Post Reply