-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Stub in exporter * remove x86 * Fix typo * remove x86 build * start converting to static * convert more to static * more static * break out parser from UI (maybe more to move later) * fix binary copy path * Rough hookup of ParseCaptureFile to export code * better json formatting * Add more detail to exported frames * convert enums as strings * Add byte array converter * Add ClientRequestId * Add response request-id * Restore some code only used for test automation
- Loading branch information
1 parent
5308cb7
commit e0cb1b9
Showing
17 changed files
with
3,104 additions
and
2,839 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace MAPIInspector | ||
{ | ||
public class ByteArrayConverter : JsonConverter | ||
{ | ||
public override void WriteJson( | ||
JsonWriter writer, | ||
object value, | ||
JsonSerializer serializer) | ||
{ | ||
if (value == null) | ||
{ | ||
writer.WriteNull(); | ||
return; | ||
} | ||
|
||
byte[] data = (byte[])value; | ||
|
||
writer.WriteValue(BitConverter.ToString(data).Replace("-", "")); | ||
} | ||
|
||
public override object ReadJson( | ||
JsonReader reader, | ||
Type objectType, | ||
object existingValue, | ||
JsonSerializer serializer) | ||
{ | ||
if (reader.TokenType == JsonToken.String) | ||
{ | ||
// Parse the hex string into a byte array | ||
string hexString = (string)reader.Value; | ||
byte[] byteData = new byte[hexString.Length / 2]; | ||
|
||
for (int i = 0; i < byteData.Length; i++) | ||
{ | ||
byteData[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16); | ||
} | ||
|
||
return byteData; | ||
} | ||
else | ||
{ | ||
throw new Exception( | ||
string.Format( | ||
"Unexpected token parsing binary. " | ||
+ "Expected String, got {0}.", | ||
reader.TokenType)); | ||
} | ||
} | ||
|
||
public override bool CanConvert(Type objectType) | ||
{ | ||
return objectType == typeof(byte[]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set PathToBinaries=%1 | ||
set FiddlerPath=%2 | ||
|
||
xcopy "%PathToBinaries%*.*" %FiddlerPath%\Inspectors\ /Q /Y | ||
xcopy "%PathToBinaries%*.*" %FiddlerPath%\ImportExport\ /Q /Y | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
using System.Windows.Forms; | ||
using Fiddler; | ||
using System.Collections.Generic; | ||
using MapiInspector; | ||
|
||
[ProfferFormat("MAPI", "Parsed MAPI frames")] | ||
public class MAPIExporter : ISessionExporter | ||
{ | ||
public bool ExportSessions(string sFormat, Session[] oSessions, Dictionary<string, object> dictOptions, | ||
EventHandler<ProgressCallbackEventArgs> evtProgressNotifications) | ||
{ | ||
bool result; | ||
|
||
string filePath = null; | ||
if (null != dictOptions && dictOptions.ContainsKey("FilePath")) | ||
{ | ||
filePath = dictOptions["FilePath"] as string; | ||
} | ||
|
||
if (string.IsNullOrEmpty(filePath)) filePath = Fiddler.Utilities.ObtainSaveFilename("Export As " + sFormat, "JSON File (*.json)|*.json"); | ||
|
||
if (string.IsNullOrEmpty(filePath)) return false; | ||
|
||
try | ||
{ | ||
MAPIParser.ParseCaptureFile(oSessions, filePath); | ||
result = true; | ||
} | ||
catch (Exception ex) | ||
{ | ||
MessageBox.Show(ex.Message, "Failed to export"); | ||
result = false; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
public void Dispose() { } | ||
} |
Oops, something went wrong.