Skip to content

Commit

Permalink
Merge pull request #44 from FangfangFan/master
Browse files Browse the repository at this point in the history
ONESTORE Parser CheckIn
  • Loading branch information
IamWenboZhang committed Jul 24, 2019
2 parents 8de7422 + 7746374 commit bbc2b48
Show file tree
Hide file tree
Showing 18 changed files with 1,965 additions and 83 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
/MAPIInspector/Source/.vs/
/MAPIInspector/Source/obj/
/MAPIInspector/Source/bin/
/FSSHTTPWOPIInspector/Source/.vs/FSSHTTPandWOPIInspector/v15
/FSSHTTPWOPIInspector/Test/WOPIautomation/.vs/WOPIautomation/v15/Server/sqlite3
/Program Files/Fiddler2/Inspectors
24 changes: 20 additions & 4 deletions FSSHTTPWOPIInspector/Source/FSSHTTPandWOPIInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ public abstract class FSSHTTPandWOPIInspector : Inspector2
/// </summary>
public List<byte[]> FSSHTTPBBytes { get; set; }

/// <summary>
/// Gets whether the message is ONESTORE protocol message
/// </summary>
public static bool IsOneStore;

/// <summary>
/// Encrypted Object Group ID or Object ID List in ONESTORE protocol message
/// </summary>
public static List<ExtendedGUID> encryptedObjectGroupIDList = new List<ExtendedGUID>();

/// <summary>
/// Bool value indicate wether errorCode in FSSHTTP response is duplicate
/// </summary>
Expand Down Expand Up @@ -262,7 +272,7 @@ public object ParseHTTPPayloadForFSSHTTP(HTTPHeaders responseHeaders, byte[] byt
MemoryStream ms = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(FSSHTTPRequest ?? ""));
XmlSerializer serializer = new XmlSerializer(typeof(RequestEnvelope));
RequestEnvelope requestEnvelop = (RequestEnvelope)serializer.Deserialize(ms);
objectOut = requestEnvelop.Body;
objectOut = requestEnvelop.Body;

// if SubRequestData has fsshttpb messages do parser.
if (requestEnvelop.Body.RequestCollection != null)
Expand Down Expand Up @@ -558,7 +568,6 @@ public void TryParseFSSHTTPBRequestMessage(Request[] Requests, byte[] bytesFromH

foreach (Request req in Requests)
{

if (req.SubRequest != null && req.SubRequest.Length > 0)
{
foreach (SubRequestElementGenericType subreq in req.SubRequest)
Expand All @@ -584,8 +593,8 @@ public void TryParseFSSHTTPBRequestMessage(Request[] Requests, byte[] bytesFromH
FsshttpbRequest Fsshttpbreq = (FsshttpbRequest)ParseFSSHTTPBBytes(FSSHTTPBIncludeBytes, TrafficDirection.In);
subreq.SubRequestData.IncludeObject = Fsshttpbreq;
FSSHTTPBBytes.Add(FSSHTTPBIncludeBytes);
}
}
}
}
}
}
}
Expand All @@ -606,6 +615,12 @@ public void TryParseFSSHTTPBResponseMessage(Response[] Responses, byte[] bytesFr

foreach (Response res in Responses)
{
// If response is for ONESTORE,set FSSHTTPandWOPIInspector.IsOneStore ture.
if (res.Url.EndsWith(".one") || res.Url.EndsWith(".onetoc2"))
{
FSSHTTPandWOPIInspector.IsOneStore = true;
}

if (res.SubResponse != null && res.SubResponse.Length > 0)
{
foreach (SubResponseElementGenericType subres in res.SubResponse)
Expand Down Expand Up @@ -665,6 +680,7 @@ public object ParseFSSHTTPBBytes(byte[] FSSHTTPBbytes, TrafficDirection directio
FsshttpbRes.Parse(s);
objectOut = FsshttpbRes;
}

return objectOut;

}
Expand Down
3 changes: 2 additions & 1 deletion FSSHTTPWOPIInspector/Source/FSSHTTPandWOPIInspector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Program Files\Fiddler2\Inspectors\</OutputPath>
<OutputPath>..\..\..\..\..\AppData\Local\Programs\Fiddler\Inspectors\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down Expand Up @@ -122,6 +122,7 @@
<Compile Include="Parsers\FSSHTTP.cs" />
<Compile Include="Parsers\FSSHTTPB.cs" />
<Compile Include="Parsers\FSSHTTPD.cs" />
<Compile Include="Parsers\ONESTORE.cs" />
<Compile Include="Parsers\WOPI.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utilities.cs" />
Expand Down
20 changes: 20 additions & 0 deletions FSSHTTPWOPIInspector/Source/Parsers/BaseStructure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@ public virtual void Parse(Stream s)
stream = s;
}

/// <summary>
/// Parse the ObjectData structure for ONESTORE message.
/// </summary>
/// <param name="s">A stream containing ObjectData structure.</param>
/// <param name="partitionId">A compact unsigned 64-bit integer that specifies the object partition Id of the object.</param>
public virtual void Parse(Stream s, ulong partitionId)
{
stream = s;
}

/// <summary>
/// Parse the Data structure for ONESTORE message.
/// </summary>
/// <param name="s">A stream containing Data structure for ONESTORE message.</param>
/// <param name="is2ndParse">A bool value that specifies is 2nd Parse Data structure for ONESTORE message.</param>
public virtual void Parse(Stream s, bool is2ndParse)
{
stream = s;
}

/// <summary>
/// Override the ToString method to return empty.
/// </summary>
Expand Down
Loading

0 comments on commit bbc2b48

Please sign in to comment.