What coding language should I begin with?

Thursday, March 3, 2011

What coding language should I pick to start coding spy programs?

That's the question I hear most:
What coding language should I pick to start coding spy programs?

By experience, I started with Visual Basic 5, in 1999. Even though I didn't use Windows APIs (Application Programming Interface) I liked the easiness that coding in VB5 was. But you can't go much further without using Windows API, that's what spy programming is all about. With the APIs you will be able to code virtually anything (no pun intended). I found later that VB COULD call APIs, then I changed to VB 6. I managed to make my first "internet" programs, like Ghostvoice. It was connecting to an IP, sending and receiving data! But I was using 2 API calls, and the rest, I relied in VB OCX controls, Winsock + direct speech. Yuck, if the remote computer doesn't have the OCX or even, the VB runtimes, your program will CHOKE, by the means, it won't even start.

So I saw that VB wasn't really my thing, and fastly moved to Delphi 5, and since then I settled forever. Delphi makes it perfect for malware coding, since you don't need any external requirements, only it being Windows OS. It's basically APIs all over, you won't be doing anything else, apart from the VCL, that is a wrapper for visual Windows API, like CreateWindow(), SetForegroundWindow(), ShowWindow(), CallWndProc(), etc. Delphi is pretty easy to learn and it's very intuitive.

It's almost like talking to the code, where you want a piece of code that does something, you do:

procedure DoMyStuff(var MyStuff);
begin
ProcessStuff(MyStuff);
end;

As you can see, there are BEGIN and END blocks, code that doesn't return a value are "PROCEDURE"'s and code that return a value are "FUNCTION"'s. So, before anybody ask, yes I would for sure recomend you starting with Delphi. Then after you grasp your handles with Delphi (pun intended) you can move to C++, and who knows, an ASM compiler such as FASM or NASM (my favorite).

By now, I would not recomend .NET (any 'sharp' language), since it also relies on a framework, that needs to be pre-installed on the computer.
Get coding, you can even try a free IDE called Lazarus, that is for Object Pascal, at
Author: caesar2k
www.lazarus.freepascal.org
READ MORE - What coding language should I begin with?

How to get requested controller name, action name and id in Rails3 view

To get requested controller name, action name and id in view we will call a simple helper function. For example we have the '/users/show/23' request, by routing rule: 'match ':controller(/:action(/:id(.:format)))''
#to get controller name:
<%= controller.controller_name %>
#=> 'users'
#to get action name, it is the method:
<%= controller.action_name %>
#=> 'show'
#to get id information:
<%= ActionController::Routing::Routes.recognize_path(request.url)[:id] %>
#=> '23'
READ MORE - How to get requested controller name, action name and id in Rails3 view

Each loop for a class or model instance variables


Sometimes we need to check all of instance variables in a class or model one by one. In this exaple we will check if a varaible is an Array or not:

your_model.instance_variables.each do |i|
if your_model.instance_variable_get(i).instance_of?(Array) then
#your code to do anything with your_model.instance_variable_get(i) what is a value
end
end

If you have an active record model, you can do:

@account = Account.first
Account.column_names.each do |i|
@account.instance_eval(i)
# row returns @account.name for example inside the loop, next @account.address and so on
end


READ MORE - Each loop for a class or model instance variables