You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

YetAnotherPacketParser

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

YetAnotherPacketParser

Yet Another Packet Parser parses .docx quiz bowl packets and translates them to different formats like JSON or HTML

1.2.1
Source
nugetNuGet
Version published
Maintainers
1
Created
Source

Yet Another Packet Parser

Introduction

Yet Another Packet Parser (YAPP) is a parser for quiz bowl packets written in C#. Some of its features are

  • Converts packets in a docx or HTML file to JSON or HTML
  • MODAQ can read the JSON packets it outputs
  • Can convert each packet in a zip file
  • Specific error messages that give a line number and text near where the parser failed

You can try out a simple demo of the parser here.

Usage

Command-line program

The command line program takes in a docx file and writes it to another file (by default, JSON)

YetAnotherPacketParserCommandLine.exe -i C:\qbsets\packet1.docx -o C:\qbsets\packet1.json

If you want to output it to an HTML file, set the format to html

YetAnotherPacketParserCommandLine.exe -i C:\qbsets\packet1.docx -o C:\qbsets\packet1.json -f html

To see the list of all flags, run

YetAnotherPacketParserCommandLine.exe --help

Library

YAPP comes with a C# library that is consumable through Nuget. You need to get the stream to the file and set the right compiler options, then call PacketConverter.ConvertPackets. For example, to convert a packet to HTML, you can use something like

IPacketConverterOptions packetCompilerOptions = new HtmlPacketCompilerOptions()
{
    StreamName = "packet1.html",
    PrettyPrint = options.PrettyPrint
};

IEnumerable<ConvertResult> results;
using (FileStream fileStream = new FileStream("C:\\qbsets\\packet1.docx", FileMode.Open, FileAccess.Read, FileShare.Read))
{
    results = await PacketConverter.ConvertPacketsAsync(fileStream, packetCompilerOptions);
}

ConvertResult compileResult = outputResults.First();
if (!compileResult.Result.Success)
{
    Console.Error.WriteLine(compileResult.Result);
    return;
}

File.WriteAllText(options.Output, compileResult.Result.Value);

Note that the method can take in a zip file too, and it will return all of the packets it attempted to parse.

Development

Requirements:

  • .Net 6 SDK
    • If using Visual Studio, you need at least Visual Studio 2017.5
    • Nuget packages should be automatically downloaded by running dotnet build or through dotnet restore

Keywords

quizbowl

FAQs

Package last updated on 16 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts