Skip to content

Instantly share code, notes, and snippets.

@hkneptune
hkneptune / soap_request_mtom.cs
Created March 27, 2026 04:08
SOAP Request Samples
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
/// <summary>Holds file attachment metadata for a SOAP request.</summary>
public class AttachmentData
@hkneptune
hkneptune / wildfly-control.sh
Created October 14, 2025 03:36
WildFly Startup Script
#!/bin/bash
# WildFly Startup Script
# Configuration variables
WILDFLY_HOME="/opt/wildfly-12.0.0.Final"
STANDALONE_DIR="standalone"
BIND_ADDRESS="0.0.0.0"
WILDFLY_BIN="${WILDFLY_HOME}/bin"
STANDALONE_FULL_PATH="${WILDFLY_HOME}/${STANDALONE_DIR}"
@hkneptune
hkneptune / sha256sum.java
Created October 9, 2023 03:58
SHA256Sum
public static String sha256(File input) throws IOException {
Digest sha256 = new Digest();
sha256.update(Files.readAllBytes(input.toPath()));
StringBuilder buff = new StringBuilder();
for (byte b : sha256.digest()) {
buff.append(String.format("%02x", b & 0xFF));
}
@hkneptune
hkneptune / xml_signing.java
Created October 9, 2023 03:51
Signing XML File Content with p12 File
public static String signXmlContent(String inputFile, String keyStoreFilePath,
String keyStorePassword, String keyStoreAlias) throws Exception {
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(new FileInputStream(keyStoreFilePath), keyStorePassword.toCharArray());
DocumentBuilderFactory buildFactory = DocumentBuilderFactory.newInstance();
buildFactory.setNamespaceAware(true);
Document document = buildFactory.newDocumentBuilder().parse(inputFile);
XMLSignatureFactory xmLSignatureFactory = XMLSignatureFactory.getInstance("DOM",
(Provider) Class.forName("org.jcp.xml.dsig.internal.dom.XMLDSigRI").newInstance());
@hkneptune
hkneptune / centos8.md
Created February 17, 2022 02:00
Upgrade CentOS Linux 8 to CentOS Stream 8

Fix the AppStream Issue

[root@centos8 ~]# yum update
CentOS-8 - AppStream 71 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

As CentOS Linux 8 had reached the End Of Life (EOL) on December 31st, 2021. It means that CentOS 8 will no longer receive development resources from the official CentOS project. To keep your CentOS updated, you may update the mirrors or upgrade to CentOS Stream.

@hkneptune
hkneptune / Discuz4.0.0Crack.md
Created January 1, 2022 05:49
Discuz 4.0.0 (20051001) Crack

Discuz! 4.0.0 (20051001) Crack

  1. Replace the include/validate.class.php file
  2. Create a discuz_license.php file in the root directory
/*
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/
var $jscomp = $jscomp || {};
$jscomp.scope = {};
$jscomp.arrayIteratorImpl = function(array) {
var index = 0;
return function() {
@hkneptune
hkneptune / jquery-script.js
Created September 29, 2020 10:00
jQuery - Open All URLs In New Tab
jQuery(document).on('click', 'body a', function(e){
e.preventDefault();
var url = jQuery(this).attr('href');
window.open(url, '_blank');
});
@hkneptune
hkneptune / Normalize.java
Last active January 31, 2022 20:21
The utility class to solve the Path Manipulation issue found by the Fortify Static Code Analyzer.
/**
* Path Manipulation (Input Validation and Representation, Data Flow)
*
* **Abstract:**
*
* Attackers are able to control the file system path argument, which allows them to access or
* modify otherwise protected files.
*
* **Explanation:**
*
@hkneptune
hkneptune / maven-resources-plugin.xml
Created May 21, 2020 02:49
Copy External Libraries to War Package
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>