Skip to content

Commit e034854

Browse files
committed
updates
1 parent c14d792 commit e034854

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

ch13_automating_metasploit/MetasploitSession.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22
using System.Collections.Generic;
33
using System.Net;
44
using System.IO;
5-
using System.Net.Sockets;
65
using MsgPack.Serialization;
76
using MsgPack;
8-
using System.Collections.Specialized;
9-
using System.Text;
10-
using System.Collections;
11-
using System.ComponentModel;
127

138
namespace ch13_automating_metasploit
149
{

ch3_soap_fuzzer/Main.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ public static void Main (string[] args)
2424
HttpWebRequest req = (HttpWebRequest)WebRequest.Create (_endpoint + "?WSDL");
2525
XmlDocument wsdlDoc = new XmlDocument ();
2626

27-
wsdlDoc.Load (req.GetResponse ().GetResponseStream ());
27+
using (WebResponse resp = req.GetResponse())
28+
using (Stream respStream = resp.GetResponseStream())
29+
wsdlDoc.Load(respStream);
2830

2931
_wsdl = new WSDL (wsdlDoc);
3032

@@ -90,7 +92,7 @@ static void FuzzSoapPort (SoapBinding binding)
9092
}
9193

9294

93-
XDocument soapDoc = new XDocument (new XDeclaration ("1.0", "utf-16", "true"),
95+
XDocument soapDoc = new XDocument (new XDeclaration ("1.0", "ascii", "true"),
9496
new XElement (soapNS + "Envelope",
9597
new XAttribute (XNamespace.Xmlns + "soap", soapNS),
9698
new XAttribute ("xmlns", xmlNS),
@@ -105,7 +107,9 @@ static void FuzzSoapPort (SoapBinding binding)
105107
req.Method = "POST";
106108
req.ContentType = "text/xml";
107109
req.ContentLength = data.Length;
108-
req.GetRequestStream ().Write (data, 0, data.Length);
110+
111+
using (Stream stream = req.GetRequestStream())
112+
stream.Write (data, 0, data.Length);
109113

110114
string resp = string.Empty;
111115
try {

ch3_soap_fuzzer/SoapMessagePart.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ public SoapMessagePart (XmlNode part)
1212

1313
if (part.Attributes["element"] != null)
1414
this.Element = part.Attributes["element"].Value;
15-
else
15+
else if (part.Attributes["type"] != null)
1616
this.Type = part.Attributes["type"].Value;
17+
else
18+
throw new ArgumentException("Neither element nor type attribute exist", nameof(part));
1719
}
1820

1921
public string Name { get; set; }

0 commit comments

Comments
 (0)