[QUOTE=Bumrang;33884771]I'd rather not run Linux in a VM just to connect to a vent server, so I can't use Mangler.
Is there any way I can make my own program that connects to vent servers?
If not, I will have to resort to reverse-engineering. I've actually wanted to learn assembly/reverse-engineering for quite a bit now and it will probably become [I]really[/I] useful in the future.[/QUOTE]
Learning assembly isn't the easiest thing to do, and being good enough to reverse engineer entire protocols is also not easy.
Why not just look at the Mangler source?
[QUOTE=robmaister12;33883872]C is essentially C++ without classes or such a large standard library. IIRC <cstring> only includes methods that deal with char[]s, like strlen, strcomp, etc. and string.h includes std::String as well as similar methods that work with std::String.[/QUOTE]
Aren't structures pretty much classes in C?
[QUOTE=thisBrad;33884810]
[B]Why not just look at the Mangler source?[/B][/QUOTE]
Oh god I feel so stupid for not thinking about that.
Thanks.
[QUOTE=Meatpuppet;33884928]Aren't structures pretty much classes in C?[/QUOTE]
Sort of. I'm pretty sure classes in c++ are just specialized structs. True object oriented program isn't possible in C though, although things like glib approximate it through macros that do type checking and functions that take a struct as their first argument.
[QUOTE=Octave;33885010]Sort of. I'm pretty sure classes in c++ are just specialized structs. True object oriented program isn't possible in C though, although things like glib approximate it through macros that do type checking and functions that take a struct as their first argument.[/QUOTE]
IIRC Structs default to public and classes do the opposite
[QUOTE=Bumrang;33884771]I'd rather not run Linux in a VM just to connect to a vent server, so I can't use Mangler.
Is there any way I can make my own program that connects to vent servers?
If not, I will have to resort to reverse-engineering. I've actually wanted to learn assembly/reverse-engineering for quite a bit now and it will probably become [I]really[/I] useful in the future.[/QUOTE]
Just compile Mangler with MinGW/msys in Windows. [url]http://www.mangler.org/building/[/url]
If you don't want to do that, Mangler still has the vent network protocol documented and you can build your own UI on top of that.
Or you could, you know, just use the free official Ventrilo client.
You're going to spend months if not years learning assembly, low-level networking, and audio compression algorithms in order to figure out how the network protocol works when there's already a completely documented version available for you. There's really no need for reverse engineering by disassembling a program and looking at the result. If you REALLY wanted to waste time reverse engineering this yourself, you're better off using wireshark to intercept packets and try to interpret them, that way you don't have to know exactly which sections of assembly are used for transmitting data instead of encoding audio, etc.
For pretty much anything you can think of, there will be an open-source version of it. Especially with things that deal with networking. Use that to your advantage.
[QUOTE=Meatpuppet;33882299]
[cpp] ship1.ShipLoadImage("movingobject.png");[/cpp]
Undefined reference to Spaceship::ShipLoadImage(std::string constant&)[/QUOTE]
Make sure all your files are included in your project.
[QUOTE=Meatpuppet;33884928]Aren't structures pretty much classes in C?[/QUOTE]
Nope, structs in C are just ways of addressing groups of variables, structs in C++ are just classes that default to public but still allow you to do things like inheritance and instance methods.
Suppose I have an array of numbers where one or more would go missing. An example: 1, 2, 3, 4, 5 is the array of numbers. Say 2 and 5 goes missing. What would an effective algorithm to determine which ones are missing be?
It's possibly obvious but I can't wrap my head around it right now.
Use a for loop?
[QUOTE=Within;33885686]Suppose I have an array of numbers where one or more would go missing. An example: 1, 2, 3, 4, 5 is the array of numbers. Say 2 and 5 goes missing. What would an effective algorithm to determine which ones are missing be?
It's possibly obvious but I can't wrap my head around it right now.[/QUOTE]
It depends:
Are all the numbers in order? like 1,2,3,4, etc...?
Then you could just use a for loop and check if the number in the for loop is missing in the array or not, just like the poster before.
If they are not in order and you have an copy of the array before some of the numbers were deleted, you could just make a copy of that array and then check if anything is missing from the original array by comparing the two.
If they are not in order and you don't have a copy of the array before the numbers were deleted then I don't think it is possible unless the numbers are in some kind of pattern.
[QUOTE=Within;33885686]Suppose I have an array of numbers where one or more would go missing. An example: 1, 2, 3, 4, 5 is the array of numbers. Say 2 and 5 goes missing. What would an effective algorithm to determine which ones are missing be?
It's possibly obvious but I can't wrap my head around it right now.[/QUOTE]
Well it depends on whether or not values can repeat. Assuming your array is a set (no repeating):
Let A be a subset of U = {1, 2, 3, 4, 5}.
(A intersect U)' will be the values in U but not in A. It is also equivalent to U - A, depending on which set operations you have available in the language you're using.
If your numbers can repeat and there is no limit to the numbers, you could try something like this:
[csharp]
oldArray = new int[] { 1, 2, 3, 4, 5, 6 };
newArray = new int[] { 1, 4, 6 };
List<int> missingNumbers = new List<int>();
for (int i = 0; i < newArray.Length; i++)
{
while (i + missingNumbers.Count() < newArray.Length && newArray[i] != oldArray[i + missingNumbers.Count()])
{
missingNumbers.Add(oldArray[i + missingNumbers.Count()]);
}
}
[/csharp]
You can change the whole List<int> business to just an int that increments inside the while loop if you don't care about which numbers are missing.
[editline]24th December 2011[/editline]
hmmm actually that sample code won't work if the last numbers don't match... one sec, fixing it.
I wanted to learn how to make a crypter (makes .exe's un-modifiable/reverse engineerable), but I am not too sure where to start. Any pointers/tips?
A crypter is actually just something used to hide malware from antiviruses, it'll do something simple like change every instance of "a" to "$" in the executable to avoid virus signature matching. When the virus wants to run, another executable will load the virus into memory, change the symbol back, and invoke the executable from memory. (At least that's what I got from a few minutes of Googling)
If you're trying to check for exe modification, you're looking at DRM, and there has never been a 100% successful DRM scheme. And there's no way to prevent reverse engineering, if someone wants to sit there for years detailing out millions of assembly instructions until they understand everything that your program is doing, let them.
If you're talking about interpreted/JITed languages being decompiled back into the original language, there's always obfuscation - running a script that automatically gives variables, methods, and classes very simple and non-descriptive names like single letters, making it harder for someone to figure out what your program is doing.
Anyone here good with regex? I need some help.
I have a string, and I need to extract the two numbers after the place name for fun stuff elsewhere (In this case, the two numbers are 4 and 6 ).
[code]
26TH AVE : Surf: 4-6 ft.
[/code]
However, with my current expression, it captures the "26" in 26TH AVE also. Anyone know of a regular expression that doesn't do that?
EDIT: Nevermind, I figured out a way.
[QUOTE=krazipanda;33886635]I wanted to learn how to make a crypter (makes .exe's un-modifiable/reverse engineerable), but I am not too sure where to start. Any pointers/tips?[/QUOTE]
First of all, I'm going to say this: Anything that executes on your computer is modifiable and reverse engineerable, no matter what you do to stop it.
[QUOTE=Jookia;33888134]First of all, I'm going to say this: Anything that executes on your computer is modifiable and reverse engineerable, no matter what you do to stop it.[/QUOTE]
Yup, most protectors have moved past attempting to encrypt assemblies and stop debuggers. They now do obfuscating and virtualization. Pretty much protection through obscurity :P.
Can someone help me with this? It only happens on Android 4.0.1, it works fine on 2.3.3:
Error log:
[code]
12-25 11:24:57.718: W/LesroosterApp(747): Attempting to get data from: http://publish.gepro-osi.nl/roosters/rooster.php?leerling=123456&type=Leerlingrooster&afdeling=2h5-1&wijzigingen=1&school=1288
12-25 11:24:57.734: D/dalvikvm(747): GC_CONCURRENT freed 95K, 2% free 14496K/14727K, paused 4ms+6ms
12-25 11:24:57.749: W/LesroosterApp(747): Something went wrong while getting HTTP data:
12-25 11:24:57.749: W/LesroosterApp(747): [Message> null
12-25 11:24:57.749: W/LesroosterApp(747): [Cause> null
12-25 11:24:57.749: W/LesroosterApp(747): [Class> class android.os.NetworkOnMainThreadException
12-25 11:24:57.749: W/LesroosterApp(747): End of error report
12-25 11:24:57.749: W/System.err(747): android.os.NetworkOnMainThreadException
12-25 11:24:57.749: W/System.err(747): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1084)
12-25 11:24:57.749: W/System.err(747): at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
12-25 11:24:57.749: W/System.err(747): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
12-25 11:24:57.749: W/System.err(747): at java.net.InetAddress.getAllByName(InetAddress.java:220)
12-25 11:24:57.749: W/System.err(747): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
12-25 11:24:57.749: W/System.err(747): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
12-25 11:24:57.749: W/System.err(747): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
12-25 11:24:57.749: W/System.err(747): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
12-25 11:24:57.749: W/System.err(747): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
12-25 11:24:57.749: W/System.err(747): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
12-25 11:24:57.749: W/System.err(747): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
12-25 11:24:57.749: W/System.err(747): at com.gware.lesrooster.GetMethodEx.getHTTP(GetMethodEx.java:26)
12-25 11:24:57.749: W/System.err(747): at com.gware.lesrooster.LesroosterActivity.updateRooster(LesroosterActivity.java:203)
12-25 11:24:57.749: W/System.err(747): at com.gware.lesrooster.LesroosterActivity.onCreate(LesroosterActivity.java:81)
12-25 11:24:57.749: W/System.err(747): at android.app.Activity.performCreate(Activity.java:4465)
12-25 11:24:57.749: W/System.err(747): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
12-25 11:24:57.749: W/System.err(747): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
12-25 11:24:57.757: W/System.err(747): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
12-25 11:24:57.757: W/System.err(747): at android.app.ActivityThread.access$600(ActivityThread.java:122)
12-25 11:24:57.757: W/System.err(747): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
12-25 11:24:57.757: W/System.err(747): at android.os.Handler.dispatchMessage(Handler.java:99)
12-25 11:24:57.757: W/System.err(747): at android.os.Looper.loop(Looper.java:137)
12-25 11:24:57.757: W/System.err(747): at android.app.ActivityThread.main(ActivityThread.java:4340)
12-25 11:24:57.757: W/System.err(747): at java.lang.reflect.Method.invokeNative(Native Method)
12-25 11:24:57.757: W/System.err(747): at java.lang.reflect.Method.invoke(Method.java:511)
12-25 11:24:57.757: W/System.err(747): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
12-25 11:24:57.757: W/System.err(747): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
12-25 11:24:57.757: W/System.err(747): at dalvik.system.NativeStart.main(Native Method)
[/code]
Piece of code in question:
[code]public class GetMethodEx {
public String getHTTP(String url) throws Exception {
BufferedReader in = null;
String data = null;
Log.w("LesroosterApp", "Attempting to get data from: " + url);
try {
HttpClient client = new DefaultHttpClient();
URI website = new URI(url);
HttpGet request = new HttpGet();
request.setURI(website);
HttpResponse response = client.execute(request);
in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String l = "";
String nl = System.getProperty("line.separator");
while ((l = in.readLine()) != null) {
sb.append(l + nl);
}
in.close();
data = sb.toString();
Log.w("LesroosterApp", "Data get!");
return data;
}finally{
if (in != null) {
try {
in.close();
return data;
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}[/code]
The url is: [url]http://publish.gepro-osi.nl/roosters/rooster.php?leerling=123456&type=Leerlingrooster&afdeling=2h5-1&wijzigingen=1&school=1288[/url]
[QUOTE=Octave;33885010]Sort of. I'm pretty sure classes in c++ are just specialized structs. True object oriented program isn't possible in C though, although things like glib approximate it through macros that do type checking and functions that take a struct as their first argument.[/QUOTE]
What's this true object-oriented programming that's impossible in C? I agree that there is not [i]one true way[/i] to do object-oriented programming in C. There are thousands.
Private and public access (including object.h doesn't give you direct access to the struct but allows you to use the getters/setters):
[cpp]/* object.h */
typedef struct _object object;
int object_GetVariable(object *obj);
void object_SetVariable(object *obj, int var);
/* object.c */
typedef struct _object
{
int var;
} object;
int object_GetVariable(object *obj)
{
return obj->var;
}
void object_SetVariable(object *obj, int var)
{
obj->var = var;
}[/cpp]
One way to do inheritance and function overloading:
[cpp]const char CHILD0 = 1;
const char CHILD1 = 2;
typedef int (*func)(int arg);
typedef struct _parent
{
char identifier;
} parent;
typedef struct _child0
{
parent common;
/* something else */
} child0;
typedef struct _child1
{
parent common;
/* and more */
} child1;
typedef struct _class
{
func magic;
} class;
class classes [3]; // global class list
int parent_IsChild0(parent *p)
{
return p->identifier == CHILD0;
}
int parent_IsChild1(parent *p)
{
return p->identifier == CHILD1;
}
class *parent_GetClass(parent *p)
{
return &classes[p->identifier];
}
child0 *parent_AsChild0(parent *p)
{
return (child0 *)p;
}
child1 *parent_AsChild1(parent *p)
{
return (child1 *)p;
}
int parent_CallMagic(parent *p, int arg)
{
return parent_GetClass(p)->magic(arg);
}[/cpp]
C# / Windows Phone 7 development
I believe Windows Phone uses the .NET Compact Framework, and it's missing a synchronous webrequest.
Now that by itself isn't the problem, however, consider the following code:
[csharp]
/// <summary>
/// Loads a player's profile from a specific URI.
/// </summary>
/// <param name="profileUrl">The <c>System.Uri</c> to a player's profile in XML format.</param>
/// <returns>A <c>SteamCommunity.Profile</c> instance that belongs to the player.</returns>
public static Profile LoadByUri(Uri profileUrl)
{
Profile p = null;
WebClient w = new WebClient();
w.OpenReadCompleted += new OpenReadCompletedEventHandler(LoadByUri_OpenReadCompleted);
w.OpenReadAsync(profileUrl);
return p;
}
private static void LoadByUri_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
XDocument xD = XDocument.Load(e.Result);
xD.Root.Element("steamID64").Value;
}
[/csharp]
In the OpenReadAsync callback, I want to parse the response stream and return a new Profile instance. However, how do I access Profile 'p' in LoadByUri? I can use a private static member variable, but that feels wrong in this case.
[editline].[/editline]
Fixed, see below.
I have a problem with GWEN and SFML, tho i believe SFML has nothing to do with this. Now, when i try to create canvas i get 9 linker errors:
[code]
1>gwen_static.lib(Windows.obj) : error LNK2001: unresolved external symbol __imp__SetCursor@4
1>gwen_static.lib(Windows.obj) : error LNK2001: unresolved external symbol __imp__LoadCursorW@8
1>gwen_static.lib(Windows.obj) : error LNK2001: unresolved external symbol __imp__CloseClipboard@0
1>gwen_static.lib(Windows.obj) : error LNK2001: unresolved external symbol __imp__SetClipboardData@8
1>gwen_static.lib(Windows.obj) : error LNK2001: unresolved external symbol __imp__EmptyClipboard@0
1>gwen_static.lib(Windows.obj) : error LNK2001: unresolved external symbol __imp__OpenClipboard@4
1>gwen_static.lib(Windows.obj) : error LNK2001: unresolved external symbol __imp__GetClipboardData@4
1>gwen_static.lib(Windows.obj) : error LNK2001: unresolved external symbol __imp__GetOpenFileNameA@4
1>gwen_static.lib(Windows.obj) : error LNK2001: unresolved external symbol __imp__GetSaveFileNameA@4
[/code]
You've failed to include necessary Windows libraries, it appears
[QUOTE=T3hGamerDK;33852756]I get a segmentation fault when running this project: [url]https://github.com/mastersrp/hacktheplanet[/url]
(it requires this: [url=https://github.com/mastersrp/libscript]libscript[/url] which may cause the segmentation fault, although I'm not sure why)[/QUOTE]
Can anyone help with this? I have no idea what I'm doing wrong :smith:
I have "Use Of MFC" set to "Use Standard Windows Libraries"
[QUOTE=horsedrowner;33890356]C# / Windows Phone 7 development
I believe Windows Phone uses the .NET Compact Framework, and it's missing a synchronous webrequest.
Now that by itself isn't the problem, however, consider the following code:
[csharp]
/// <summary>
/// Loads a player's profile from a specific URI.
/// </summary>
/// <param name="profileUrl">The <c>System.Uri</c> to a player's profile in XML format.</param>
/// <returns>A <c>SteamCommunity.Profile</c> instance that belongs to the player.</returns>
public static Profile LoadByUri(Uri profileUrl)
{
Profile p = null;
WebClient w = new WebClient();
w.OpenReadCompleted += new OpenReadCompletedEventHandler(LoadByUri_OpenReadCompleted);
w.OpenReadAsync(profileUrl);
return p;
}
private static void LoadByUri_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
XDocument xD = XDocument.Load(e.Result);
xD.Root.Element("steamID64").Value;
}
[/csharp]
In the OpenReadAsync callback, I want to parse the response stream and return a new Profile instance. However, how do I access Profile 'p' in LoadByUri? I can use a private static member variable, but that feels wrong in this case.[/QUOTE]
Never mind, I fixed it. Or rather, I worked around it.
I moved the WebClient to the application page, and instead I made a Profile.Parse that returns a profile based on the XML string. That way I can avoid the issue entirely.
I'm having a bit of a vimrc problem for gVim on Windows 7 x64. When I launch gVim from the start menu, it loads the global _vimrc from C:\Program Files (x86)\Vim\_vimrc. However, when I launch it from Windows Explorer (right click->Edit with Vim), it doesn't appear to load any vimrc. According to documentation it should load $HOME/_vimrc (C:\Users\myusername\_vimrc) but it doesn't load that either. Any ideas?
For some reason, it isn't displaying my sprite.
[url]http://pastebin.com/Sz527LSr[/url]
header: [url]http://pastebin.com/RAcg9Mjw[/url]
source: [url]http://pastebin.com/6TUxhd2C[/url]
[QUOTE=Meatpuppet;33893571]For some reason, it isn't displaying my sprite.
[url]http://pastebin.com/Sz527LSr[/url]
header: [url]http://pastebin.com/RAcg9Mjw[/url]
source: [url]http://pastebin.com/6TUxhd2C[/url][/QUOTE]
Do a check if the image is actually loading in [code]int Spaceship::ShipLoadImage(const std::string& path)[/code]
LoadFromFile() returns a boolean. True if it successfully loads and false if not.
[editline]25th December 2011[/editline]
If you're using Visual Studio, and if you're running the program from the IDE, filenames will load relative to the project location -- not the .exe location.
(C:\Users\You\Visual Studio 200X\Projects\Application\Application)
I'm guessing you're trying to load the file relative to the .exe location.
Made it return EXIT_FAILURE if false, nothing. It shows the background, but still isn't drawing it.
Maybe you need to set all those little things like the scale and colour and stuff (although I'd think they'd be 1/white by default)
Sorry, you need to Log In to post a reply to this thread.