Package burp.api.montoya.proxy.http
Interface InterceptedResponse
- All Superinterfaces:
HttpMessage
,HttpResponse
,InterceptedHttpMessage
HTTP response intercepted by Burp Proxy.
-
Method Summary
Modifier and TypeMethodDescriptionattributes
(AttributeType... types) Retrieve the values of response attributes.body()
Body of a message as a byte array.int
Offset within the message where the message body begins.Body of a message as aString
.boolean
Searches the data in the HTTP message for the specified search term.boolean
Searches the data in the HTTP message for the specified regular expression.cookies()
Obtain details of the HTTP cookies set in the response.cookieValue
(String name) This method retrieves the IP address for the destination of the intercepted message.boolean
boolean
boolean
hasHeader
(HttpHeader header) Offset within the message where the message body begins.boolean
boolean
headers()
HTTP headers contained in the message.headerValue
(String name) Return the HTTP Version text parsed from the response line for HTTP 1 messages.Obtain the MIME type of the response, as inferred from the contents of the HTTP message body.boolean
isStatusCodeClass
(StatusCodeClass statusCodeClass) Test whether the status code is in the specified class.keywordCounts
(String... keywords) Retrieve the number of types given keywords appear in the response.This method retrieves the name of the Burp Proxy listener that is processing the intercepted message.markers()
Markers for the message.int
This method retrieves a unique ID for this request/response.mimeType()
Obtain the MIME type of the response, as determined by Burp Suite.Obtain the HTTP reason phrase contained in the response for HTTP 1 messages.request()
This method retrieves the IP address for the source of the intercepted message.Obtain the MIME type of the response, as stated in the HTTP headers.short
Obtain the HTTP status code contained in the response.Message as a byte array.toString()
Message as aString
.withAddedHeader
(HttpHeader header) Create a copy of theHttpResponse
with the added header.withAddedHeader
(String name, String value) Create a copy of theHttpResponse
with the added header.Create a copy of theHttpResponse
with the updated body.
Updates Content-Length header.Create a copy of theHttpResponse
with the updated body.
Updates Content-Length header.withHttpVersion
(String httpVersion) Create a copy of theHttpResponse
with the new http version.withMarkers
(Marker... markers) Create a copy of theHttpResponse
with the added markers.withMarkers
(List<Marker> markers) Create a copy of theHttpResponse
with the added markers.withReasonPhrase
(String reasonPhrase) Create a copy of theHttpResponse
with the new reason phrase.withRemovedHeader
(HttpHeader header) Create a copy of theHttpResponse
with the removed header.withRemovedHeader
(String name) Create a copy of theHttpResponse
with the removed header.withStatusCode
(short statusCode) Create a copy of theHttpResponse
with the provided status code.withUpdatedHeader
(HttpHeader header) Create a copy of theHttpResponse
with the updated header.withUpdatedHeader
(String name, String value) Create a copy of theHttpResponse
with the updated header.Methods inherited from interface burp.api.montoya.http.message.responses.HttpResponse
copyToTempFile, withAddedHeaders, withAddedHeaders, withRemovedHeaders, withRemovedHeaders, withUpdatedHeaders, withUpdatedHeaders
-
Method Details
-
request
HttpRequest request()- Returns:
- initiatingRequest The HTTP request that was sent.
- See Also:
-
initiatingRequest
HttpRequest initiatingRequest()- Returns:
- initiatingRequest The HTTP request that was sent.
-
annotations
Annotations annotations()- Returns:
- Annotations for request/response.
-
statusCode
short statusCode()Obtain the HTTP status code contained in the response.- Specified by:
statusCode
in interfaceHttpResponse
- Returns:
- HTTP status code.
-
reasonPhrase
String reasonPhrase()Obtain the HTTP reason phrase contained in the response for HTTP 1 messages. HTTP 2 messages will return a mapped phrase based on the status code.- Specified by:
reasonPhrase
in interfaceHttpResponse
- Returns:
- HTTP Reason phrase.
-
isStatusCodeClass
Test whether the status code is in the specified class.- Specified by:
isStatusCodeClass
in interfaceHttpResponse
- Parameters:
statusCodeClass
- The class of status code to test.- Returns:
- True if the status code is in the class.
-
httpVersion
String httpVersion()Return the HTTP Version text parsed from the response line for HTTP 1 messages. HTTP 2 messages will return "HTTP/2"- Specified by:
httpVersion
in interfaceHttpMessage
- Specified by:
httpVersion
in interfaceHttpResponse
- Returns:
- Version string
-
headers
List<HttpHeader> headers()HTTP headers contained in the message.- Specified by:
headers
in interfaceHttpMessage
- Specified by:
headers
in interfaceHttpResponse
- Returns:
- A list of HTTP headers.
-
hasHeader
Offset within the message where the message body begins.- Specified by:
hasHeader
in interfaceHttpMessage
- Specified by:
hasHeader
in interfaceHttpResponse
- Parameters:
header
- The header to check if it exists in the request.- Returns:
- The message body offset.
-
hasHeader
- Specified by:
hasHeader
in interfaceHttpMessage
- Specified by:
hasHeader
in interfaceHttpResponse
- Parameters:
name
- The name of the header to query within the request.- Returns:
- True if a header exists in the request with the supplied name.
-
hasHeader
- Specified by:
hasHeader
in interfaceHttpMessage
- Specified by:
hasHeader
in interfaceHttpResponse
- Parameters:
name
- The name of the header to check.value
- The value of the header to check.- Returns:
- True if a header exists in the request that matches the name and value supplied.
-
header
- Specified by:
header
in interfaceHttpMessage
- Specified by:
header
in interfaceHttpResponse
- Parameters:
name
- The name of the header to retrieve.- Returns:
- An instance of
HttpHeader
that matches the name supplied,null
if no match found.
-
headerValue
- Specified by:
headerValue
in interfaceHttpMessage
- Specified by:
headerValue
in interfaceHttpResponse
- Parameters:
name
- The name of the header to retrieve.- Returns:
- The
String
value of the header that matches the name supplied,null
if no match found.
-
body
ByteArray body()Body of a message as a byte array.- Specified by:
body
in interfaceHttpMessage
- Specified by:
body
in interfaceHttpResponse
- Returns:
- The body of a message as a byte array.
-
bodyToString
String bodyToString()Body of a message as aString
.- Specified by:
bodyToString
in interfaceHttpMessage
- Specified by:
bodyToString
in interfaceHttpResponse
- Returns:
- The body of a message as a
String
.
-
bodyOffset
int bodyOffset()Offset within the message where the message body begins.- Specified by:
bodyOffset
in interfaceHttpMessage
- Specified by:
bodyOffset
in interfaceHttpResponse
- Returns:
- The message body offset.
-
markers
Markers for the message.- Specified by:
markers
in interfaceHttpMessage
- Specified by:
markers
in interfaceHttpResponse
- Returns:
- A list of markers.
-
cookies
Obtain details of the HTTP cookies set in the response.- Specified by:
cookies
in interfaceHttpResponse
- Returns:
- A list of
Cookie
objects representing the cookies set in the response, if any.
-
cookie
- Specified by:
cookie
in interfaceHttpResponse
- Parameters:
name
- The name of the cookie to find.- Returns:
- An instance of
Cookie
that matches the name provided.null
if not found.
-
cookieValue
- Specified by:
cookieValue
in interfaceHttpResponse
- Parameters:
name
- The name of the cookie to retrieve the value from.- Returns:
- The value of the cookie that matches the name provided.
null
if not found.
-
hasCookie
- Specified by:
hasCookie
in interfaceHttpResponse
- Parameters:
name
- The name of the cookie to check if it exists in the response.- Returns:
true
If a cookie exists within the response that matches the name provided.false
if not.
-
hasCookie
- Specified by:
hasCookie
in interfaceHttpResponse
- Parameters:
cookie
- An instance ofCookie
to check if it exists in the response.- Returns:
true
If a cookie exists within the response that matches theCookie
provided.false
if not.
-
mimeType
MimeType mimeType()Obtain the MIME type of the response, as determined by Burp Suite.- Specified by:
mimeType
in interfaceHttpResponse
- Returns:
- The MIME type.
-
statedMimeType
MimeType statedMimeType()Obtain the MIME type of the response, as stated in the HTTP headers.- Specified by:
statedMimeType
in interfaceHttpResponse
- Returns:
- The stated MIME type.
-
inferredMimeType
MimeType inferredMimeType()Obtain the MIME type of the response, as inferred from the contents of the HTTP message body.- Specified by:
inferredMimeType
in interfaceHttpResponse
- Returns:
- The inferred MIME type.
-
keywordCounts
Retrieve the number of types given keywords appear in the response.- Specified by:
keywordCounts
in interfaceHttpResponse
- Parameters:
keywords
- Keywords to count.- Returns:
- List of keyword counts in the order they were provided.
-
attributes
Retrieve the values of response attributes.- Specified by:
attributes
in interfaceHttpResponse
- Parameters:
types
- Response attributes to retrieve values for.- Returns:
- List of
Attribute
objects.
-
contains
Searches the data in the HTTP message for the specified search term.- Specified by:
contains
in interfaceHttpMessage
- Specified by:
contains
in interfaceHttpResponse
- Parameters:
searchTerm
- The value to be searched for.caseSensitive
- Flags whether the search is case-sensitive.- Returns:
- True if the search term is found.
-
contains
Searches the data in the HTTP message for the specified regular expression.- Specified by:
contains
in interfaceHttpMessage
- Specified by:
contains
in interfaceHttpResponse
- Parameters:
pattern
- The regular expression to be searched for.- Returns:
- True if the pattern is matched.
-
toByteArray
ByteArray toByteArray()Message as a byte array.- Specified by:
toByteArray
in interfaceHttpMessage
- Specified by:
toByteArray
in interfaceHttpResponse
- Returns:
- The message as a byte array.
-
toString
String toString()Message as aString
.- Specified by:
toString
in interfaceHttpMessage
- Specified by:
toString
in interfaceHttpResponse
- Overrides:
toString
in classObject
- Returns:
- The message as a
String
.
-
withStatusCode
Create a copy of theHttpResponse
with the provided status code.- Specified by:
withStatusCode
in interfaceHttpResponse
- Parameters:
statusCode
- the new status code for response- Returns:
- A new
HttpResponse
instance.
-
withReasonPhrase
Create a copy of theHttpResponse
with the new reason phrase.- Specified by:
withReasonPhrase
in interfaceHttpResponse
- Parameters:
reasonPhrase
- the new reason phrase for response- Returns:
- A new
HttpResponse
instance.
-
withHttpVersion
Create a copy of theHttpResponse
with the new http version.- Specified by:
withHttpVersion
in interfaceHttpResponse
- Parameters:
httpVersion
- the new http version for response- Returns:
- A new
HttpResponse
instance.
-
withBody
Create a copy of theHttpResponse
with the updated body.
Updates Content-Length header.- Specified by:
withBody
in interfaceHttpResponse
- Parameters:
body
- the new body for the response- Returns:
- A new
HttpResponse
instance.
-
withBody
Create a copy of theHttpResponse
with the updated body.
Updates Content-Length header.- Specified by:
withBody
in interfaceHttpResponse
- Parameters:
body
- the new body for the response- Returns:
- A new
HttpResponse
instance.
-
withAddedHeader
Create a copy of theHttpResponse
with the added header.- Specified by:
withAddedHeader
in interfaceHttpResponse
- Parameters:
header
- TheHttpHeader
to add to the response.- Returns:
- The updated response containing the added header.
-
withAddedHeader
Create a copy of theHttpResponse
with the added header.- Specified by:
withAddedHeader
in interfaceHttpResponse
- Parameters:
name
- The name of the header.value
- The value of the header.- Returns:
- The updated response containing the added header.
-
withUpdatedHeader
Create a copy of theHttpResponse
with the updated header.- Specified by:
withUpdatedHeader
in interfaceHttpResponse
- Parameters:
header
- TheHttpHeader
to update containing the new value.- Returns:
- The updated response containing the updated header.
-
withUpdatedHeader
Create a copy of theHttpResponse
with the updated header.- Specified by:
withUpdatedHeader
in interfaceHttpResponse
- Parameters:
name
- The name of the header to update the value of.value
- The new value of the specified HTTP header.- Returns:
- The updated response containing the updated header.
-
withRemovedHeader
Create a copy of theHttpResponse
with the removed header.- Specified by:
withRemovedHeader
in interfaceHttpResponse
- Parameters:
header
- TheHttpHeader
to remove from the response.- Returns:
- The updated response containing the removed header.
-
withRemovedHeader
Create a copy of theHttpResponse
with the removed header.- Specified by:
withRemovedHeader
in interfaceHttpResponse
- Parameters:
name
- The name of the HTTP header to remove from the response.- Returns:
- The updated response containing the removed header.
-
withMarkers
Create a copy of theHttpResponse
with the added markers.- Specified by:
withMarkers
in interfaceHttpResponse
- Parameters:
markers
- Request markers to add.- Returns:
- A new
MarkedHttpRequestResponse
instance.
-
withMarkers
Create a copy of theHttpResponse
with the added markers.- Specified by:
withMarkers
in interfaceHttpResponse
- Parameters:
markers
- Request markers to add.- Returns:
- A new
MarkedHttpRequestResponse
instance.
-
messageId
int messageId()This method retrieves a unique ID for this request/response.- Specified by:
messageId
in interfaceInterceptedHttpMessage
- Returns:
- An identifier that is unique to a single request/response pair. Extensions can use this to correlate details of requests and responses and perform processing on the response message accordingly.
-
listenerInterface
String listenerInterface()This method retrieves the name of the Burp Proxy listener that is processing the intercepted message.- Specified by:
listenerInterface
in interfaceInterceptedHttpMessage
- Returns:
- The name of the Burp Proxy listener that is processing the intercepted message. The format is the same as that shown in the Proxy Listeners UI - for example, "127.0.0.1:8080".
-
sourceIpAddress
InetAddress sourceIpAddress()This method retrieves the IP address for the source of the intercepted message.- Specified by:
sourceIpAddress
in interfaceInterceptedHttpMessage
- Returns:
- The IP address for the source of the intercepted message.
-
destinationIpAddress
InetAddress destinationIpAddress()This method retrieves the IP address for the destination of the intercepted message.- Specified by:
destinationIpAddress
in interfaceInterceptedHttpMessage
- Returns:
- The IP address for the destination of the intercepted message.
-