Burp Extension Development - burp

Does anybody know of a way to test if the burp scanner has completed when developing burp extensions?
I am developing a burp extension that hooks into the scanner and i would like to display my results after the scanner has completed. I do not know how to test if the scanner has completed.
Thanks in advance

The following works from within the Burp Extender Jython Shell. Hope it helps.
import jarray
callbacks = Burp._callbacks
myRequest = Burp.history[0]
myHost = myRequest.host
myPort = myRequest.port
myByteArray= jarray.array(myRequest.raw, 'b')
testScan = callbacks.doActiveScan(myHost, myPort, 0, myByteArray)
# int showing percentage complete
print testScan.percentageComplete

Related

How to extract browser cookie(s) using Katalon Studio

I am trying to get all the cookies of the browser which is opened while we execute automation test using Katalon.
Please suggest how we can extract a specific cookie/list of cookies using Katalon.
I have checked in traditional Selenium/Java; its pretty easy -
driver.manage().getCookieNamed("Cookie Name").getValue();
But I am not getting any clue how to do this in Katalon.
Resolved it....
import com.kms.katalon.core.webui.driver.DriverFactory
import org.openqa.selenium.WebDriver
WebDriver driver = DriverFactory.getWebDriver() println driver.manage().getCookieNamed("Cookie Name").getValue()

Pass custom HTTP header from Windows Phone to ASMX service

Problem: Want to send a custom HTTP header from Windows Phone 7.1 app to ASMX service. The ASMX service is developed by different team.
Solutions tried: There are number of questions & answers on net for this, but nothing seem to work in our case.
Refered HttpRequestMessageProperty,
and this.
Client Side Code:
HttpRequestMessageProperty httpProps = new HttpRequestMessageProperty();
httpProps.SuppressEntityBody = false;
httpProps.Headers["HeaderKey"] = "HeaderValue";
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpProps;
Service Side Code:
public string GetHeaderValue()
{
var properties = OperationContext.Current.IncomingMessageProperties;
var property = properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
string headerValue = property.Headers["HeaderKey"];
return headerValue;
}
The "HeaderKey" value is not available on service side. Can any one point us in right direction ? Any help will be appreciated.
Thank you.
Ok, So after some hits and misses, the below code worked:
HttpContext.Current.Request.Headers.GetValues("HeaderKey")[0];
The issue with using OperationContext was for ASMX the OperationContext.Current was null. In WCF service, the OperationContext.Current is available.
Thanks #user623396 for your time and efforts. Hope this helps someone out.

WebService in Lotus Domino in Java getting the IP Address of the Client

We have written a webservice provider in Java in Lotus Domino. Now we would like to obtain the IP Address of the webservice Consument, but unfortunately this is not easy.
My first try was :
mc = MessageContext.getCurrentContext();
String remoteAddr = "REMOTE_ADDR?" + mc.getProperty("REMOTE_ADDR");
Second try:
String remoteIP = mc.getStrProp(Constants.MC_REMOTE_ADDR);
Not working as well.
So i have tried to get all properties available in the MessageContext
Iterator x = mc.getPropertyNames();
while (x.hasNext()) {
String strX = x.next().toString();
// OutPut of the strX
}
And the output was:
RPC
transport.url
Well, nothing helpfull.
Has anybody found a working solution?
According to this blog http://www.unimatrix-0.de/index.php?option=com_content&view=article&id=50:messagecontext-im-domino-webservice&catid=35:webservices&Itemid=55 in the old version there were only a few properties, which were distributed from axis.
Thanx a lot for any idea.
WebServiceBase.getAgentSession().getAgentContext().getDocumentContext().getItemValueString("Remote_Addr");
note: there might be easier way to get AgentContext, but this works. and as long as it compiles..:-)

Google Glass GDK: Generate Notification Sound

I want to generate a notification sound after a certain event on Google Glass. This is what I have tried
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_action_done)
.setContentTitle("Message Receied")
.setContentText("New message received")
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
//alert
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(1, builder.build());
As well as this
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(context, notification);
r.play();
The first code snippet doesn't return anything nor does it do anything. I'm unsure on how Glass handles notifications considering the lack of a notification center. The second code snippet throws the following error in logcat
06-02 15:05:30.248: D/MediaPlayer(32271): Couldn't open file on client side, trying server side
06-02 15:05:30.279: E/MediaPlayer(32271): Unable to create media player
06-02 15:05:30.279: D/Ringtone(32271): Problem opening; delegating to remote player
Does anyone have an idea on how to generate a sound?
Thank you
Not sure if that solve your issue, but you can generate a sound in glass with AudioManager like:
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
then,
mAudioManager.playSoundEffect(Sounds.TAP);
or
mAudioManager.playSoundEffect(Sounds.SUCCESS);
It's not a notification sound, but maybe you just need to generate a sound?, I'm not sure where your event happens...
It seems like I end up answering my own question but here is the answer if above doesn't work:
private SoundPool mSoundPool;
private int mAlertReceived;
mSoundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
mAlertReceived = mSoundPool.load(context, R.raw.tinkerbell, 1);
protected void playSound(int soundId) {
mSoundPool.play(soundId,
1 /* leftVolume */,
1 /* rightVolume */,
1,
0 /* loop */,
1 /* rate */);
}
I got this code from the GDK Stopwatch samples. There is an .ogg file in the res/raw/

c# app connectivity issue

I am new to C# and would be really grateful if someone could provide some insight on the following problem: I have written a c# app that gets the html content of a website, quite simply using a webclient. The problem is that if I run it for multiple websites I see that sometimes I get no results for some of them, like it was never connected to that website at that instance. I initially thought it was my internet connection but the same happened when I tried on a different wifi. It is worth mentioning that I have the same prob on another of my appcs when trying to connect to a webservice. My question is: does anybody know how can this be fixed? Does it have to do with the timeout time of something like that?
Thank you very much in advance
This is the code but it's not really an issue of coding:
var client = new WebClient();
try
{
var htmlcode = client.DownloadString(site);
int NumberOfTrues = Regex.Matches(htmlcode.ToLower(), key).Count;
}
catch (Exception)
{
messagebox.show("could not be loaded");
}
This was solved by defining the default proxy server in app config.