How to attach Cycrypt or gdb before a program start - ios

I am in the middle of PT where application is checking for JailBreak, sooner it starts and the first screen user see is Alert that application is Jailbroken and click okay to exit.
My question: Is there a way to attach Cycript before application starts or start application with Cycript as it seems very late to change method when it is already called by application and I am on the close alert.
Please advise.
or advise If I can run application with GDB, rather than attaching with the process later -- same issue here, it is too late to attach to gdp after running the application because decision of JailBroken is already done.

I found this link which explains in detail about run time modifications using gdb as well as with cycript.
May be helpful for you or someone else.

I just encountered same question and I got over that by using choose() in cycript and function -[UIModalView dismissWithClickedButtonIndex:animated:]
Use choose(UIAlertView) to search all AlertView
Try figure out which one is your target and call [choose(UIAlertView)[i] dismissWithClickedButtonIndex:0 animated:0]
*i is the sequence you get in step 1

Related

Difference in manual execution of running app in background and runAppInBackground() using appium

While executing runAppInBackground() for Android application through Appium the app gets restarted but when executed the same manually couldn't be able to reproduce the same. I Would like to deep dive into implementation of a runAppInBackground() method to reproduce the same issue in a manual way.
You need to look behind the code of runAppInBackground
From java client side (your test code) perspective, it is a single call to Appium server:
POST "/session/:sessionId/appium/app/background"
If you continue looking into where its implemented on server side, you finish with appium-android-driver function.
In short what it does:
Get current activity and package
Press physical Home button
Wait for time you provided as argument (seconds)
Bring up back in focus based on different conditions; from the code you can understand what activity is being started
Basically its a sequence of adb shell commands, that you can run from terminal.
My guess is that step 4 you did manually may differ from what Appium is doing: different activities/arguments for activity been called

view iphone console logs without a mac

Is there a way to view the iphone console logs without having a mac ?
It used to be possible using the iPhone Configuration Utility but it does not seem to be available any longer.
I saw a tool called iTools but it seems to require a 32bit version of itunes which is also not available any more.
Given an iPhone device + windows + linux, Is there any workaround / tool to view the iphone console logs?
Realizing it is over half a year ago you asked this, but since it does not have an accepted answer yet:
I ran into this very same issue over and over, and got fed up with it, so I decided to have a go at writing a script that displays console messages in HTML, so you can just view everything in the webpage itself, without having to resort to a console-replacement or a tedious remote debugger (for which you, indeed, require a Mac), without having to modify each console call in existing code.
The key lies in 'replacing' the four main functions in window.console: log, warn, error and trace. This is done by redifining each method, adding own code to that, and calling the original method in the end. Jakub Fiala wrote the basic script for that, on which I built the rest: https://gist.github.com/jakubfiala/8fe3461ab6508f46003d
I dubbed it 'MobileConsole'. It is quite unobtrusive and will 'catch' all console.log (or .warn, .error or .trace) events, and even bind to window.onerror.
I have created a separate page for this script with an elaborate explanation on how it works, including a demo, over here.
Download this from the app store onto the iphone, you can then view logs directly on the phone:
https://itunes.apple.com/us/app/console/id317676250?mt=8
Please note, this is an old app, it will crash when launched, then on reopening it will show you the device logs.
If that fails, here is a link to the iPhone configuration utility for windows:
http://download.cnet.com/iPhone-Configuration-Utility-for-Windows/3000-20432_4-10969175.html

Termination caused websites executing no more

I had a perfectly well running asp.net mvc application and I was debugging message sending via SignalRand I decided to stop debugging and went to edit some code. However, there was an error saying something about IIS termination and whether I want to do that because something (I assume - the application) cannot be stopped. (I am really sorry, but I didn't read it at the time). So now I try to relaunch my program and it just won't open. The website is trying to be opened but the loading circle in chrome just kept on spinning forever.
What I tried to do was:
1. restarted VS - didn't help
2. restarted PC - didn't help
3. created a new project, brought all files to it and launched it and it worked!
So then it worked for ~10 minutes or so and then just stopped again (this time no error message or anything). I tried changing a port in the settings of the project. Didn't work. Tried changing back and it launched successfully. For a minute or so... :(
So finally, I tried putting a break point right at the
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
-> {
The breakpoint was hit, it successfully passed the next line
RouteTable.Routes.MapHubs();
and just disappeared at
AreaRegistration.RegisterAllAreas();
Many times I tried and it always disappears at the same location. Going deeper is not an option since this is system method. I suspect something can be problematic with that, but I am not experienced with much configuration of asp.net.
P.S. many times VS was acting strange and even tho I set the breakpoint at the place I marked above, it showed the breakpoint with a message that it won't be hit because the source differs from the current code (But I didn't change a thing since before the very first crash! The only place I modified a few symbols at was at MyHub.cs which is an extended class for a Hub for SignalR)
Lastly, I tried deleting everything from bin folder so it got fully rebuilt, but without any success to revive my application.
What could be a possible problem, maybe someone had anything at least similar to this? Or maybe someone would be kind to help me at choosing better keywords while searching in google because "IIS termination" and "AreaRegistration.RegisterAllAreas(); not working" didn't bring me much :(
This is a known bug: https://github.com/SignalR/SignalR/issues/1335.
We have been unable to successfully reproduce this issue on our servers. We've seen that using a different web server will resolve the issue. If you're able to post a reproduction project to the linked Issue, chances are it will be resolved promptly.
Apparently, the solution I marked isn't the exact thing that helped me. This link was the thing that miraculously helped me and I was able to finally get back to work. However, I found the winning link because of N. Taylor Mullen, so he deserves the full credit :) But letting others know if anyone comes to this question :)

monodroid activity - wrong activity at start up

I have developed a monodroid application with several activities.
Occasionally, the wrong activity is shown first, as opposed to the one with "MainLauncher=true" set.
Also, occasionally I get a dialog stating "Could not determine activity to run because the generated manifest could not be found?
I occasionally see the wrong activity on startup.
I think this generally seems to be when I haven't changed any code and try to restart my application for a second debugging session.
I think what happens in this case, it that Android tries to restart my application on the page/Activity where I last left it. This situation also happens when the app is in general use - so it's good practice to write your code so that the app works in this situation (e.g. using the saved instance state bundle)

Starting a windows service fails with error 1053

I have a windows service that is failing to start, giving an error "Error 1053: The service did not respond to the start or control request in a timely fashion".
Running the service in my debugger works fine, and if I double click on the the service .exe on the remote machine a console window pops up and continues to run without problem - I can even see log messages showing me that the program is processing everything the way it should be.
The service had been running fine previously, though this is my first time, personally, trying to deploy it with the most recent changes made to the program. I've evaluated those changes and cant figure out how they might cause this problem, particuarly since everything runs fine when not started as a service.
The StartRoutine() method of the service impelmentation is empty, so should be returning in a "timely fashion".
I've checked the event logs on the computer, and it doesn't give any additional information other than it didn't hear back from the service in the 30 second requisite time frame.
Since it works on my machine, and as a double-clicked executable, how would I go about figuring out why it fails as a service?
Oh, and it's .NET 2.0, so it shouldn't be affected by the 1.1 framework bug that exhibited this symptom (http://support.microsoft.com/kb/839174)
The box is a windows server 2003 R2 machine running SP2.
This is a misleading error. It's probably an unhandled exception.
Empty your OnStart() handler then try this in your constructor...
public MainService()
{
InitializeComponent();
try
{
// All your initialization code goes here.
// For instance, my exception was caused by the lack of registry permissions
;
}
catch (Exception ex)
{
EventLog.WriteEntry("Application", ex.ToString(), EventLogEntryType.Error);
}
}
Now check the EventLog on your system for your Application Error.
Could be a number of things and it might help to get a stack trace on the machine exhibiting the problem. There are a number of ways to do this but the point is that you have to see where this is failing in the code.
You can do this with remote debugging, but a simple thing might be to just log to the event logger, or file log if you have that. Literally, putting "WriteLine("At class::function()") throughout portions of the code to see if you've made it there.
This will at least get you looking in the right direction (which ultimately is the code).
Update:
See Microsoft's How to Debug Windows Services article for details in troubleshooting startup problems using WinDbg.
This related question details nice ways to debug services that are written in .NET.
I agree with Scott, the easiest way to find out what's happening is to put some traces in the start-up code (maybe it doesn't even come to your start-up code).
If this doesn't help, you can post your code here so others can take a look.
perhaps lacking some dependence, try this :
- deregister your service
- register again
If fail at register means that lack an module.
If the StartRoutine is empty, you are probably starting it somewhere else.
IIRC you need to fire off a worker thread, and then return from StartRoutine.
One of the problems which may lead to this error is if windows service which needs to be deployed consists of some error i.e it may be simple authorization error or anything as in my case I have referenced some folders and files for logging which were not existing, but when provided the right path of those file and folders it solved my problem.
I ran through every post on this particular subject and none of the responses solved the problem, so I'm adding this response in case this helps someone else. Admittedly this only applies to a new service, not this specific case.
I was writing a File listening service. As a console app, it worked perfectly. When I ran it as a service, I got the same error as above. What I didn't know (and many of the MSDN articles about services conveniently leave out) is that you need to have your class executed from within ServiceBase.Run( YourClassName());. Otherwise, your app executes and immediately terminates and because it terminated, you get the error above even if no error or exception occurred. Here is a link to an article about this. It actually discusses setting up your app for dual use - Console app and service: Create a combo command line / Windows service app
I had that issue and the source of my problem was config file. I edited it in notepad and notepad added one special character which cause service not to run properly because config file was ruined. I saw that special character in notepadd++ and after delete it, service started to run successfully as previous did.
In my case, the correct .NET framework was not installed on the server that I was installing the Windows service on.
One other reason is If you copy the DLL in 'debug' mode to installation folder this issue will come.What you need to do is Run the project in 'Release' mode copy the DLL or directly form Release folder rather than Debug folder,,and copy that DLL in to installation folder,it will work.You can see the reduction in size of DLL ,it will not contain any debug symbols and like that

Resources