Deserializing to a completely different classname ?

Hi,
I'm trying to read in a serialized obfuscated class,
and dynamically replace it with an unobfuscated version.
The classnames, method names & field names are different, but the field types are the same.
Any ideas ? Or is it possible at all ?
any help appreciated,
cheers,
Owen
I tried the following subclass of ObjectInputStream
class MyObjectInputStream extends ObjectInputStream
  public MyObjectInputStream ( InputStream is ) throws IOException
     super ( is );
     enableResolveObject ( true );
  protected Class resolveClass(ObjectStreamClass v)
        throws IOException, ClassNotFoundException
     String classname = v.getName();
     if ( classname.equalsIgnoreCase ( "Obfuscated" ) )
     Class newClass = Class.forName ( "Deobfuscated" );
     return ( newClass );
     else
     return ( super.resolveClass ( v ) );
}but end up getting the following stack trace
java.io.InvalidClassException: Deobfuscated;
Incompatible local class name. Expected class name compatible with Obfuscated
at java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java:528)
at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java:562)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:931)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:361)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:231)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1181)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:381)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:231)
at TestOut.TestIn(TestOut.java:38)
at TestOut.main(TestOut.java:100)

I'll post the code in case anyone is curious.
Exception handling could be better in places...
cheers,
Owen
class DeobfuscateObjectInputStream extends ObjectInputStream
     public DeobfuscateObjectInputStream ( InputStream is ) throws IOException, Exception
          super ( is );
          enableResolveObject ( true );
    protected Object resolveObject(Object obj) throws IOException
        deobfuscate ( obj )
    public Object deobfuscate ( Object srcObject ) throws IOException
        Class srcClass = srcObject.getClass();
        if ( srcClass.getName().equalsIgnoreCase ( "Obfuscated" ) )
            try
                String destClassName = "Deobfuscated";  // deobfuscated class name
                Field[] srcFields = srcClass.getDeclaredFields();
                Class destClass = Class.forName ( destClassName );
                // serializable class must have an empty parameter constructor
                Object destObj = destClass.newInstance(); 
                if ( srcFields != null )
                    for ( int i=0; i<srcFields.length; i++ )
                        Field srcField  = srcFields;
Field destField = null;
try
// assumes source field name in dest field name at the moment...
destField = destClass.getDeclaredField ( srcFields[i].getName() );
int destFieldModifiers = destField.getModifiers();
int srcFieldModifiers = srcField.getModifiers();
if ( Modifier.isPrivate ( srcFieldModifiers ) )
try
srcField.setAccessible ( true );
catch ( SecurityException secEx )
System.out.println ("Security Exception : Cannot access source private variable : " + srcField.getName() );
if ( Modifier.isPrivate ( destFieldModifiers ) )
try
destField.setAccessible ( true );
catch ( SecurityException secEx )
System.out.println ("Security Exception : Cannot access dest private variable : " + destField.getName() );
if ( !Modifier.isFinal ( destFieldModifiers ) && !Modifier.isStatic ( destFieldModifiers ) )
try
destField.set ( destObj, srcField.get( srcObject ) );
System.out.println ( destField.getName() );
catch ( IllegalAccessException iex )
if ( Modifier.isPrivate ( destFieldModifiers ) )
System.out.println ( "[ error field \"" + destField.getName() + "\" is private ]" );
else
System.out.println ( "[ error attempting to set field \"" + destField.getName() + "\"  ]" );
else
if ( !Modifier.isFinal ( destFieldModifiers ) )
System.out.println ("[ skipped - is final in dest class ]");
else
System.out.println ("[ skipped - is static in dest class ]");
catch ( NoSuchFieldException ex )
System.out.println ("[ ERROR - doesnt exist in dest class]");
return ( destObj );
else
System.out.println ("\tNo Fields");
return ( destObj );
catch ( Exception ex )
ex.printStackTrace();
// convert except to IOException for resolveObject
throw ( new IOException ( ex.getMessage() ) );
else
return ( srcObject );

Similar Messages

  • I send an email from my Iphone to a friend.  My friend receives it on her Iphone, but as text message.  She replies and it goes back to my daughter's phone, a completely different email and phone number.  Why?

    I send an email from my Iphone to a friend.  My friend receives it on her Iphone, but as text message.  She replies and it goes back to my daughter's phone, a completely different email and phone number.  Why?

    We went through my friend's phone and my daughter's email and phone number are not in it.  I have never given my daughter's iphone number to my friend.  Is it something to do with gmail or my apple id?  My daughter (14) has been using my computer as her "base" for HER Iphone. 
    My friend does use her iphone number as an email address as well.
    For instance:  her phone number might look like this:  (493) 305-3958
    and her email address would look like this:  [email protected]
    If I Iphone/email my friend, she receives it as a text message.  Then if she replies to that text message, it goes to my daughter's phone and not mine.  It's completely crazy!  We searched her phone contacts and did not find my daughter's phone number anywhere or attached anywhere to mine.  Since when does Iphone emailing wind up in the text messaging area?

  • I bought a Mac Mini for the family but there's something very odd. Windows looks completely different and I'm completely confused. Is this because of Windows 8? How do I get back to my old Windows!

    Windows looks completely different and we can't use the computer. We're flumoxed, we did some research and read about this new version of Windows - is this the problem? Is there a way to revert to the older version of Windows? Apple has shot themselves in the foot with this change. Any help would be greatly appreciated.

    Macs don't come with Windows. They come with OS X. If you want Windows, you'll need to install it yourself, or return the Mac and buy a PC.

  • When in google it pulls up the results as soon as i click on a result it takes me to a completely different page

    say for instance if i search "bob the builder" in google it pulls up search results for "bob the builder" of course the official page is the first link. so i click on the official page link and it redirects me through a goingonearth.com and through one or two others and i end up on something completely different every time, like hair salons in new jersey or wheres the best place to eat and stuff like that. i realize it may be a search hijacker but ive ran hijack scanners they havent found anything ive reset all the settings manually disabled all addons, ive scanned my pc with MBAM (malware bytes and malware software) system mechanics pro McAfee and a microsoft antvirus spyware and malware scanner, and they all find nothing. what can i do to rid my pc of this stupid problem so i can use my beloved firefox browser again?

    Do a malware check with some malware scanning programs on the Windows computer.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of their databases before doing a scan.<br /><br />
    *http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    *http://www.superantispyware.com/ - SuperAntispyware
    *http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    *http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    *http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • Can I redirect to a completely different web container?

    Hi all
    How can I redirect from a Servlet to a completely different web container. For example let's say I have MyServlet running on machine A, and according to a parameter in the request, I would like to redirect to host B (to another location).
    I tried to use RequestDispatcher.forward, but it uses a relative location (even if I added the absolute URL, like http://hostb:port/new_location).
    Can I redirect to another container?
    thanks,

    Do you need to send the data to the second site as well? That's where you will run into problems.

  • Completely different AMF request packets for same remote service call from Flex to PHP using ZendAMF

    I was trying to debug why one of the remote-services in our Flex application was failing randomly. What I found was interesting. Completely different AMF request packets were sent for same remote service call from Flex to PHP.
    When the service call succeeds the AMF request packet looks like the following:
    POST /video/flex/bin-debug/gateway.php HTTP/1.1
    Host: localhost
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 115
    Cookie: PHPSESSID=j6u30i8uu6c3cvp8f4kipcpf05
    Referer: http://localhost/video/flex/bin-debug/main.swf/[[DYNAMIC]]/5
    Content-type: application/x-amf
    C    ontent-length: 305
    Flex Message (flex.messaging.messages.RemotingMessage)     operation = getMemberFromEvent    clientId = 2F997CD0-7D08-8D09-1A9B-0000422676C8    destination = MembereventService    messageId = B46AB58D-2241-83F0-41E4-9FE745565492    timestamp = 0    timeToLive = 0    body =     [      280    ]    hdr(DSId) = nil
    And when the service fails the AMF request packet looks like this:
    ServiceRequest: getMemberFromEvent; RemoteService; getMemberFromEvent
    (mx.messaging.messages::RemotingMessage)#0
      body = (Array)#1
        [0] 250
      clientId = "1AA4FAAB-AEA5-8109-4B0D-000002B3A9A1"
      destination = "MembereventService"
      headers = (Object)#2
        DSEndpoint = (null)
        DSId = "nil"
      messageId = "2F92E6C0-FE92-A09B-B150-9FE2F28D9738"
      operation = "getMemberFromEvent"
      source = "MembereventService"
      timestamp = 0
      timeToLive = 0
    Also, following is the error message on Flex when the service fails:
    {Fault code=Channel.Call.Failed, Fault string=error, Fault detail=NetConnection.Call.Failed: HTTP: Failed, Destination=MembereventService}
    We are using Swiz as the micro-architecture for Flex development and Zend AMF for remoting between Flex and PHP.
    Any ideas what is wrong here, what is causing Flex to send different request packets for the same service & what I can do to fix it?

    Hi, I know that your post is almost 5 years ago, but have you found the solution to this issue?
    Thanks.

  • My business is not appearing correctly and is taking customers to a completely different city.  Please help!

    My business is Almeria at Ocotillo Apartments and is located in Chandler Arizona.  When you use Apple Maps it takes my customers to Tempe, Arizona which is a completely different city.  Please help, address is below:
    2471 W. Edgewater Way
    Chandler, AZ 85248

    These are user forums. You are not speaking to Apple here. We can't address your issue. You can register the problem at Apple Feedback.

  • My macbook pro crashed and the hard drive was replaced. How do I restore my backup pre- 9.6 iphoto library to the 9.6.1 iphoto library? They look completely different.

    My macbook pro crashed and the hard drive was replaced. How do I restore my backup pre- 9.6 iphoto library to the 9.6.1 iphoto library? They look completely different. When I look at my backed-up iphoto library folder I see lots of files and folders: ALbumData.xml, Attachments folder, etc. The 9.6.1 iphoto library doesn't appear to be a folder at all. Help!

    iPhoto 6 and earlier libraries were regular folders with the kind of files your reporting.  With the advent of iPhoto 7 the library folder was changed to a package similar to the application packages but have essentially the same files and folders inside.  There's no reason to have access to the inside of the iPhoto Library so Apple changed them to packages.
    Do you have a backup copy of the iPhoto Library from before the HD crash.  If so restore it to the Pictures folder in your Home folder.  If you previous version of iPhoto was iPhoto 7 or earlier download and run the iPhoto Library Upgrader 1.1 on your library before trying to open it with iPhoto 9.6.1.

  • I have organised my photos in an album but when I open a new book to start putting the photos in, they come up in the book in a completely different order?

    I have organised my photos in an album but when I open a new book to start putting the photos in, the photos come up in the book in a completely different order?

    Yes - in the book they are sorted by date
    Suggest a change to Apple - iPhoto meniu ==> provide iPhoto feedback
    You can start the book with one photo and then add others by dragging them to the book project in the source pane on the left
    LN

  • How to switch to a complete different dialog/panel?

    Assume I need for a Flex app two completely different dialog panels:
    1.) Panel A with a couple of buttons, entry fields, checkboxes,...
    2.) Panel B with a big listbox and a few buttons at the bottom.
    So when the user clicks in Panel A on a certain button some cumputations were made and the result presented in Panel B.
    First question: How do I design a second Panel in Flex Builder? Is a new (different) mxml file required?
    I found no "create new panel" or similar menu.
    Second question: How can I switch fron the display of Panel A to  the display of Panel B?
    Peter

    You could use a ViewStack and create separate files or keep them in 
    the same file, or use viewStates and have them at the same file
    Sincerely,
    Michael
    El 22/04/2009, a las 14:50, pxstein <[email protected]> escribió:
    >
    Assume I need for a Flex app two completely different dialog panels:
    >
    1.) Panel A with a couple of buttons, entry fields, checkboxes,...
    2.) Panel B with a big listbox and a few buttons at the bottom.
    >
    So when the user clicks in Panel A on a certain button some 
    cumputations were made and the result presented in Panel B.
    >
    First question: How do I design a second Panel in Flex Builder? Is a 
    new (different) mxml file required?
    I found no "create new panel" or similar menu.
    >
    Second question: How can I switch fron the display of Panel A to  
    the display of Panel B?
    >
    Peter
    >

  • Maps finds addresses in a completely different city, instead of the one I'm actually in

    Why does Maps return addresses in a completely different city, even if location services are enabled? I must manually type in the city name every time, or I usually get different cities or countries (I live in a major Canadian city). Sometimes it gives me addresses on a completely different continent! I have location services enabled, and maps has no problem determining my location. How can I get it to locate the closest location to me when I do an address search?

    Thanks for the reply CT. I forgot to say I wanted to use just the keyboard. II was using the keyboard shortcut cmd-R for reply when I was having the problem.
    I think there is some set of keys that I stumbled upon once to delve into the messages in a conversation but I can't rememember it, recreate it, or always remember to highlight the message I'm looking at before I hit cmd-R.

  • Online number showing as completely Different Numb...

    My online number I have purchased with skype and have had for almost 1year.  Recently I have been told by numorous people that when I call them a completely different number is showing up on there caller ID.  I am unsure what to do please help. Thanks 

    ellaform20 wrote:
    My online number I have purchased with skype and have had for almost 1year.  Recently I have been told by numorous people that when I call them a completely different number is showing up on there caller ID.  I am unsure what to do please help. Thanks 
    Have you enabled Caller ID for your Skype account?  Online Numbers are not automatically used as Caller ID when calling telephones from a Skype account.  You should be able to go into your Skype program - or log into your account on the Skype web page - and enable Caller ID.  Note that not all Online Numbers can be used for Caller ID.
    http://www.skype.com/intl/en/features/allfeatures/​caller-identification
    If you have not enabled Caller ID for your Skype account, callers may see numbers that do not look like a "normal" phone number showing up when you call them.  Depending on where you call, callers may still not see your Online Number on their Caller ID once you enable that on your Skype account. 
    Hope that helps....
    Patrick
    Location/Ubicacion: Arizona USA
    Time Zone/Hora Local: UTC/GMT -7
    If this message has adequately addressed your issue, please click on the “Accept as Solution” button. If you found a post useful then please "Give Kudos" at the bottom of my post, so that this information can benefit others.
    Si esto mensaje le ha ayudado, por favor haga clic en "Aceptar como solución". Si encuentra un mensaje útil, por favor "Da Kudos" al final del mensaje, por lo que esta información puede beneficiar a otros.
    I am not a Skype employee. No soy un empleado de Skype.

  • LR exporting jpegs completely differently all of a sudden?

    I have noticed within the last few days that all the jpegs I'm exporting are suddenly completely different than what shows on screen in the develop module. The are exporting way over-sharpened and with too much contrast. To my knowledge, I didn't change any settings and the Export gui looks the same as it always has (set to export at 100 quality, 300 dpi). I have been using Lightroom for years and never had this problem before. Any ideas??

    Here is an example. I've also looked through other photos I've shot and edited in the last month (that exported from Lightroom correctly at the time) and they are now displayed differently in Lightroom vs the jpg. So I think Lightroom must not proprerly applying/displaying the edits I'm making in the develop module. But it's only happened in the last couple days and I have no idea why. Is there a solution?

  • If i tap somewhere on my Ipod touch 5 then it will tap somewhere completely different or even if i dont tap anything it will tap something anyways. Do i need to calibrate it somehow or what?

    If i tap somewhere on my Ipod touch 5 then it will tap somewhere completely different or even if i dont tap anything it will tap something anyways. Do i need to calibrate it somehow or what?

    There is no calibaration.
    Make sure the screen is clean
    Try:
    - Reset the iOS device. Nothing will be lost      
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup. See:                                               
    iOS: Back up and restore your iOS device with iCloud or iTunes
    - Restore to factory settings/new iOS device.                       
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
      Apple Retail Store - Genius Bar              

  • On my screen my iChat name shows as my AIM handle, but other people are showing a completely different name. Anyone know how to correct this?

    On my screen my iChat name shows as my AIM handle, but other people are showing a completely different name. Anyone know how to correct this?

    Hi,
    I still have you in my Buddy list.
    Whereas you were showing just plain "Norma"  you are now showing "Norma Howe" in Capital Letters.
    The only way I know to achieve that at my end is to View any Display Name that was set up or Add those "First Name, Last Name" Details to my address Book and list your Screen Name against them.
    IF the AIM Settings Display Name items does not List NORMA HOWE and in fact lists something else the only thing I can think of is another App allows the Display name to be set from there and this is overriding the AIM Setting info.
    I fired up an old version of AIM for Mac (version 4.7 from 2005) on my G4 computer running Leopard.
    This Identifies Buddies that have entered Display Names  (puts them in the Quotes as in "NORMA HOWE")
    In the Preferences of this version of AIM for Mac it has a Sign On tab.
    This has a box to enter how you show up (i.e. the Display Name)  This version hints at adding Capitalisation and Spaces to your Screen Name.
    Actually when I tried to change it to anything this version refused to let me.
    So I changed my regular Name to "Ralph Johns r"
    This however does not change the AIM settings page
    Uploaded with Skitch!
    This would suggest that if the AIM setting page does not have this info then it is an AIM app somewhere.
    Boot Camp and  windows Version ?
    AIM for Mac (Any versions) ?  (I am prettry sure it will be  alter version than mine as the Self Listing shows the changed Name but still lists it as the Screen Name in the info Screen)
    AIM on a Phone or iPad ?
    8:38 PM      Thursday; April 5, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.3)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

Maybe you are looking for