// the page layout with sidebar and report section.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Executive Dashboard</title>
<style>
:root {
--corporate-blue: #003366;
--button-blue: #0059b3;
--button-hover: #0073e6;
--focus-color: #ffcc00;
}
html, body {
height: 100%;
margin: 0;
}
body {
font-family: Arial, sans-serif;
background-color: #f0f2f5;
}
.container {
display: flex;
gap: 20px;
padding: 10px;
height: 100vh;
box-sizing: border-box;
}
.sidebar {
display: flex;
flex-direction: column;
gap: 10px;
min-width: 250px;
padding: 15px;
border-radius: 8px;
background-color: var(--corporate-blue);
height: 97%;
}
.button-group .oj-button.left-btn {
width: 100%;
background-color: var(--button-blue);
color: white;
border: none;
padding: 12px;
border-radius: 6px;
cursor: pointer;
font-weight: 600;
transition: background-color 0.2s;
}
.button-group .oj-button.left-btn:hover {
background-color: var(--button-hover);
}
.button-group .oj-button.left-btn:focus {
outline: 2px solid var(--focus-color);
outline-offset: 2px;
}
.button-group .oj-button.left-btn.active {
background-color: var(--button-hover);
font-weight: 700;
}
.report-section {
flex: 1;
padding: 15px;
border-radius: 8px;
background-color: var(--corporate-blue);
display: flex;
flex-direction: column;
}
.report-heading {
color: white;
margin-bottom: 15px;
}
.report-embed {
width: 100%;
flex: 1;
border-radius: 8px;
background-color: white;
overflow: hidden;
}
.report-embed iframe,
.report-embed oracle-dv {
width: 100%;
height: 100%;
border: 0;
display: block;
}
</style>
</head>
<body>
<div class="container">
// Sidebar Navigation: Each button represents a report:
<nav class="sidebar button-group" role="navigation" aria-label="Report selection">
<button class="oj-button left-btn active" type="button"
data-type="iframe"
data-src="https://example.com/ui/dv/ui/project.jsp?pageid=visualAnalyzer&reportmode=full&reportpath=%2F%40Catalog%2Fshared%2FIFRAME%2FIFRAME%2FHR%20Attrition%20WB"
onclick="switchReport(this)">
Workforce Employee Attrition Report
</button>
<button class="oj-button left-btn" type="button"
data-type="dv"
data-project-path="/@Catalog/shared/IFRAME/IFRAME/Sales Portfolio"
data-tab-id="snapshot!canvas!19"
onclick="switchReport(this)">
Sales Report
</button>
<button class="oj-button left-btn" type="button"
data-type="dv"
data-project-path="/@Catalog/shared/IFRAME/IFRAME/customer and region performance " data-tab-id="snapshot!canvas!21"
data-tab-id="snapshot!canvas!21"
onclick="switchReport(this)">
Customer &amp; Region Performance
</button>
<button class="oj-button left-btn" type="button"
data-type="dv"
data-project-path="/@Catalog/shared/IFRAME/IFRAME/Promotions1"
data-tab-id="snapshot!canvas!1"
onclick="switchReport(this)">
Promotions Report
</button>
</nav>
// Report Display Area: Acts as a placeholder and Oracle Analytics reports load dynamically here
<main class="report-section" role="main">
<h2 class="report-heading">Executive Dashboard</h2>
<div id="reportContainer" class="report-embed"></div>
</main>
</div>
//Oracle Analytics Embedding SDK
<script src="https://example.com/public/dv/v2/embedding/auto/embedding.js"></script>
<script>
let dvInstance = null;
function loadIframe(src) {
const container = document.getElementById('reportContainer');
container.innerHTML = `
<iframe src="${src}" allowfullscreen></iframe>
`;
}
//Load a report dynamically
function loadDV(projectPath, tabId) {
const container = document.getElementById('reportContainer');
container.innerHTML = '';
if (!dvInstance) {
dvInstance = document.createElement('oracle-dv');
dvInstance.setAttribute('id', 'oracleDV');
dvInstance.setAttribute('project-path', projectPath);
dvInstance.setAttribute('active-page', 'insight');
dvInstance.setAttribute('active-tab-id', tabId);
dvInstance.setAttribute(
'project-options',
'{"bDisableMobileLayout":false,"bShowFilterBar":false}'
);
container.appendChild(dvInstance);
} else {
dvInstance.setAttribute('project-path', projectPath);
dvInstance.setAttribute('active-tab-id', tabId);
dvInstance.setAttribute(
'project-options',
'{"bDisableMobileLayout":false,"bShowFilterBar":false}'
);
container.appendChild(dvInstance);
}
//Applying Bindings: This ensures the selected report is rendered properly.
oracle.oa.embedding.ready().then(oApp => {
oApp.applyBindings();
console.log(`Report loaded: ${projectPath} - ${tabId}`);
});
}
// Switch report based on clicked button
function switchReport(button) {
const type = button.getAttribute('data-type');
document.querySelectorAll('.left-btn').forEach(btn => {
btn.classList.toggle('active', btn === button);
});
if (type === 'iframe') {
loadIframe(button.getAttribute('data-src'));
} else {
loadDV(
button.getAttribute('data-project-path'),
button.getAttribute('data-tab-id')
);
}
}
// Load default report on page load
oracle.oa.embedding.ready()
.then(() => {
const defaultButton = document.querySelector('.left-btn.active');
if (defaultButton) {
switchReport(defaultButton);
}
})
.catch(error => console.error('Oracle Analytics failed to load:', error));
</script>
</body>
</html>
/* LICENSE: GPLv2 */
#define _GNU_SOURCE
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
int main() {
int fd = open("/mnt/xfs", O_TMPFILE | O_RDWR, 0600);
if (fd < 0) {
perror("open(O_TMPFILE)");
return 1;
}
const char *msg = "O_TMPFILE with XFS!\n";
if (write(fd, msg, strlen(msg)) < 0) {
perror("write");
close(fd);
return 1;
}
/*
// Uncomment to link the file
// Link the file into the namespace to make the file visible
if (linkat(fd, "", AT_FDCWD, "/mnt/xfs/published.txt", AT_EMPTY_PATH) < 0) {
perror("linkat");
close(fd);
return 1;
}
*/
close(fd); // If never linked, file is deleted on close
return 0;
}
cgroup_FireWall.py
----------------------
# LICENSE: GPLv2
from bcc import BPF, BPFAttachType
import os
import time
import ctypes
import socket
import struct
ebpf_code = """
#include <uapi/linux/bpf.h>
#include <uapi/linux/if_ether.h>
#include <uapi/linux/ip.h>
#include <uapi/linux/tcp.h>
#include <linux/in.h>
BPF_HASH(black_list, u32, u8);
// Index 0: Total, Index 1: SYNs, Index 2: Dropped
BPF_ARRAY(stats, u64, 3);
int cgroup_firewall(struct __sk_buff *skb) {
u32 total_key = 0;
u32 drop_key = 2;
u64 *total_cnt = stats.lookup(&total_key);
if (total_cnt) lock_xadd(total_cnt, 1);
if (skb->protocol != bpf_htons(ETH_P_IP)) return 1;
u32 src_ip;
if (bpf_skb_load_bytes(skb, 12, &src_ip, 4) < 0) return 1;
// Blacklist Check
if (black_list.lookup(&src_ip)) {
u64 *drop_cnt = stats.lookup(&drop_key);
if (drop_cnt) lock_xadd(drop_cnt, 1);
return 0; // DROP packet
}
u8 proto;
if (bpf_skb_load_bytes(skb, 9, &proto, 1) < 0) return 1;
if (proto == IPPROTO_TCP) {
u8 ihl_byte;
if (bpf_skb_load_bytes(skb, 0, &ihl_byte, 1) < 0) return 1;
u32 ip_hdr_len = (ihl_byte & 0x0F) * 4;
u8 tcp_flags;
if (bpf_skb_load_bytes(skb, ip_hdr_len + 13, &tcp_flags, 1) == 0) {
if (tcp_flags & 0x02) {
u32 syn_key = 1;
u64 *syn_cnt = stats.lookup(&syn_key);
if (syn_cnt) lock_xadd(syn_cnt, 1);
}
}
}
return 1; // PASS packet
}
"""
b = BPF(text=ebpf_code)
fn = b.load_func("cgroup_firewall", BPF.CGROUP_SKB)
blocked_ip = "w.x.y.z"
packed_ip = struct.unpack("I", socket.inet_aton(blocked_ip))[0]
b["black_list"][ctypes.c_uint32(packed_ip)] = ctypes.c_uint8(1)
cgroup_path = "/sys/fs/cgroup"
try:
fd = os.open(cgroup_path, os.O_RDONLY)
b.attach_func(fn, fd, BPFAttachType.CGROUP_INET_INGRESS)
print(f"[+] Attached. Blocking {blocked_ip}...")
except Exception as e:
print(f"[!] Error: {e}")
exit(1)
print("Monitoring... Press Ctrl+C to stop.")
try:
while True:
time.sleep(5)
s = b["stats"]
print(f"--- [STATS] Total: {s[0].value} | SYNs: {s[1].value} | Dropped: {s[2].value} ---")
# Reset stats
s[0] = s[1] = s[2] = ctypes.c_uint64(0)
except KeyboardInterrupt:
print("\n[*] Exiting...")
finally:
b.detach_func(fn, fd, BPFAttachType.CGROUP_INET_INGRESS)
os.close(fd)
mytracee.c
----------------
/* LICENSE: GPLv2 */
#include <stdio.h>
#include <unistd.h>
int abc(int local_abc) {
//lets loop and get debugged by the tracer
printf("Addeess of local_abc: %p\n", &local_abc);
while(1) {
}
return(local_abc);
}
int main() {
int local_main = 0x12345;
int pid = getpid();
printf("Tracee PID: %d\n", getpid());
abc(local_main);
return 0;
}
mytracer.c
----------------
/* LICENSE: GPLv2 */
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/user.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
pid_t tracee_pid;
int status;
struct user_regs_struct regs;
long get_word(pid_t tracee_pid, void *addr) {
long word;
errno = 0;
word = ptrace(PTRACE_PEEKTEXT, tracee_pid, addr, NULL);
if (errno != 0) {
perror("ptrace(PTRACE_PEEKTEXT)");
ptrace(PTRACE_DETACH, tracee_pid, NULL, NULL);
exit(1);
}
return word;
}
void set_word(pid_t tracee_pid, void *addr, long data) {
errno = 0;
if (ptrace(PTRACE_POKETEXT, tracee_pid, addr, data) == -1) {
perror("ptrace(PTRACE_POKETEXT)");
exit(1);
}
}
int wait_and_dumpreg() {
// wait for child/tracee to complete exec and stop in main
waitpid(tracee_pid, &status, 0);
if(!WIFSTOPPED(status)) {
printf("Tracee error, did not stop");
return(1);
}
if(ptrace(PTRACE_GETREGS, tracee_pid, NULL, &regs) == -1){
printf("PTRACE_GETREGS Error..");
} else {
printf("RIP: 0x%llx RSP: 0x%llx \n",
(unsigned long long)regs.rip,
(unsigned long long)regs.rsp);
}
return(0);
}
int main(void){
int rc = 0;
long data;
unsigned long addr;
unsigned long txt;
long original_data;
tracee_pid = fork();
if(tracee_pid == 0){
ptrace(PTRACE_TRACEME, 0, NULL, NULL);
execl("./tracee", "./tracee", NULL);
perror("execl");
_exit(1);
}
rc = wait_and_dumpreg();
ptrace(PTRACE_CONT, tracee_pid, NULL, NULL);
rc = wait_and_dumpreg();
printf("Enter the memory address to read (in hexadecimal): ");
if (scanf("%lx", &addr) != 1) {
fprintf(stderr, "Invalid address format\n");
ptrace(PTRACE_DETACH, tracee_pid, NULL, NULL); // Detach from the target process
return (1);
}
// Read data from the target process memory
data = get_word(tracee_pid, (void *)addr);
printf("Data at address 0x%lx: 0x%x\n", addr, data);
data = 0x678910;
printf("Write data 0x%lx at address 0x%lx\n", data, addr);
set_word(tracee_pid, (void *)addr, data);
data = get_word(tracee_pid, (void *)addr);
printf("Read data back from address 0x%lx: 0x%x\n", addr, data);
ptrace(PTRACE_CONT, tracee_pid, NULL, NULL);
return (rc);