file: upgrade to 5.43.

MFC after:	3 days
This commit is contained in:
Xin LI 2022-09-24 19:16:39 -07:00
commit a2dfb7224e
90 changed files with 7410 additions and 4398 deletions

View File

@ -1,3 +1,32 @@
2022-09-13 14:55 Christos Zoulas <christos@zoulas.com>
* release 5.43
2022-09-10 9:17 Christos Zoulas <christos@zoulas.com>
* Add octal indirect magic (Michal Gorny)
2022-08-17 11:43 Christos Zoulas <christos@zoulas.com>
* PR/374: avoid infinite loop in non-wide code (piru)
* PR/373: Obey MAGIC_CONTINUE with multiple magic files (vismarli)
2022-07-26 11:10 Christos Zoulas <christos@zoulas.com>
* Fix bug with large flist (Florian Weimer)
2022-07-07 13:21 Christos Zoulas <christos@zoulas.com>
* PR/364: Detect non-nul-terminated core filenames from QEMU
(mam-ableton)
2022-07-04 15:45 Christos Zoulas <christos@zoulas.com>
* PR/359: Add support for http://ndjson.org/ (darose)
* PR/362: Fix wide printing (ro-ee)
* PR/358: Fix width for -f - (jpalus)
* PR/356: Fix JSON constant parsing (davewhite)
2022-06-10 9:40 Christos Zoulas <christos@zoulas.com>
* release 5.42

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -168,8 +168,8 @@ am__recursive_targets = \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir distdir-am dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)config.h.in
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
config.h.in
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
@ -186,14 +186,11 @@ am__define_uniq_tagged_files = \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/libmagic.pc.in AUTHORS COPYING ChangeLog INSTALL \
NEWS TODO compile config.guess config.sub install-sh ltmain.sh \
missing
NEWS README.md TODO compile config.guess config.sub install-sh \
ltmain.sh missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@ -232,6 +229,8 @@ am__relativize = \
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
DIST_TARGETS = dist-gzip
# Exists only to be overridden by the user if desired.
AM_DISTCHECK_DVI_TARGET = dvi
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
@ -249,8 +248,9 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
@ -261,6 +261,7 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
@ -349,6 +350,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@ -557,7 +559,6 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
@ -641,6 +642,10 @@ dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
dist-zstd: distdir
tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@ -683,6 +688,8 @@ distcheck: dist
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
*.tar.zst*) \
zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
@ -698,7 +705,7 @@ distcheck: dist
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
@ -863,19 +870,19 @@ uninstall-am: uninstall-pkgconfigexecDATA
am--refresh check check-am clean clean-cscope clean-generic \
clean-libtool cscope cscopelist-am ctags ctags-am dist \
dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
dist-xz dist-zip distcheck distclean distclean-generic \
distclean-hdr distclean-libtool distclean-tags distcleancheck \
distdir distuninstallcheck dvi dvi-am html html-am info \
info-am install install-am install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am \
install-pkgconfigexecDATA install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-am uninstall uninstall-am \
uninstall-pkgconfigexecDATA
dist-xz dist-zip dist-zstd distcheck distclean \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-pkgconfigexecDATA install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am uninstall-pkgconfigexecDATA
.PRECIOUS: Makefile

View File

@ -35,7 +35,8 @@ if test "$ac_cv_struct_tm_isdst" = yes; then
fi
AC_CHECK_DECLS([daylight], , , [#include <time.h>])
AC_CHECK_DECLS([daylight], , , [#include <time.h>
#include <stdlib.h>])
AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <time.h>],

View File

@ -1,6 +1,6 @@
# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -14,13 +14,13 @@
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.69.
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
[m4_warning([this file was generated for autoconf 2.71.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.16.1], [],
m4_if([$1], [1.16.5], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.16.1])dnl
[AM_AUTOMAKE_VERSION([1.16.5])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -332,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -371,7 +371,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
done
if test $am_rc -ne 0; then
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
for automatic dependency tracking. If GNU make was not used, consider
re-running the configure script with MAKE="gmake" (or whatever is
necessary). You can also try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).])
fi
@ -398,7 +400,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -426,6 +428,10 @@ m4_defn([AC_PROG_CC])
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.65])dnl
m4_ifdef([_$0_ALREADY_INIT],
[m4_fatal([$0 expanded multiple times
]m4_defn([_$0_ALREADY_INIT]))],
[m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@ -462,7 +468,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(
m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
[ok:ok],,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
@ -514,6 +520,20 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
[m4_define([AC_PROG_OBJCXX],
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
])
# Variables for tags utilities; see am/tags.am
if test -z "$CTAGS"; then
CTAGS=ctags
fi
AC_SUBST([CTAGS])
if test -z "$ETAGS"; then
ETAGS=etags
fi
AC_SUBST([ETAGS])
if test -z "$CSCOPE"; then
CSCOPE=cscope
fi
AC_SUBST([CSCOPE])
AC_REQUIRE([AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
@ -595,7 +615,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -616,7 +636,7 @@ if test x"${install_sh+set}" != xset; then
fi
AC_SUBST([install_sh])])
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
# Copyright (C) 2003-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -637,7 +657,7 @@ AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -680,7 +700,7 @@ AC_SUBST([am__quote])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -701,12 +721,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
MISSING="\${SHELL} '$am_aux_dir/missing'"
fi
# Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then
@ -719,7 +734,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -748,7 +763,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -795,7 +810,7 @@ AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -814,7 +829,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -895,7 +910,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
# Copyright (C) 2009-2018 Free Software Foundation, Inc.
# Copyright (C) 2009-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -955,7 +970,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -983,7 +998,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2018 Free Software Foundation, Inc.
# Copyright (C) 2006-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -1002,7 +1017,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2018 Free Software Foundation, Inc.
# Copyright (C) 2004-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,

View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@ -53,7 +53,7 @@ func_file_conv ()
MINGW*)
file_conv=mingw
;;
CYGWIN*)
CYGWIN* | MSYS*)
file_conv=cygwin
;;
*)
@ -67,7 +67,7 @@ func_file_conv ()
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
cygwin/* | msys/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)

File diff suppressed because it is too large Load Diff

View File

@ -113,8 +113,8 @@
/* Define to 1 if you have the `memmem' function. */
#undef HAVE_MEMMEM
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <minix/config.h> header file. */
#undef HAVE_MINIX_CONFIG_H
/* Define to 1 if you have the `mkostemp' function. */
#undef HAVE_MKOSTEMP
@ -146,6 +146,9 @@
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
@ -305,7 +308,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
@ -315,21 +320,87 @@
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable general extensions on macOS. */
#ifndef _DARWIN_C_SOURCE
# undef _DARWIN_C_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
/* Enable X/Open compliant socket functions that do not require linking
with -lxnet on HP-UX 11.11. */
#ifndef _HPUX_ALT_XOPEN_SOCKET_API
# undef _HPUX_ALT_XOPEN_SOCKET_API
#endif
/* Identify the host operating system as Minix.
This macro does not affect the system headers' behavior.
A future release of Autoconf may stop defining this macro. */
#ifndef _MINIX
# undef _MINIX
#endif
/* Enable general extensions on NetBSD.
Enable NetBSD compatibility extensions on Minix. */
#ifndef _NETBSD_SOURCE
# undef _NETBSD_SOURCE
#endif
/* Enable OpenBSD compatibility extensions on NetBSD.
Oddly enough, this does nothing on OpenBSD. */
#ifndef _OPENBSD_SOURCE
# undef _OPENBSD_SOURCE
#endif
/* Define to 1 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_SOURCE
# undef _POSIX_SOURCE
#endif
/* Define to 2 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_1_SOURCE
# undef _POSIX_1_SOURCE
#endif
/* Enable POSIX-compatible threading on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
# undef __STDC_WANT_IEC_60559_BFP_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
# undef __STDC_WANT_IEC_60559_DFP_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
# undef __STDC_WANT_IEC_60559_TYPES_EXT__
#endif
/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
#ifndef __STDC_WANT_LIB_EXT2__
# undef __STDC_WANT_LIB_EXT2__
#endif
/* Enable extensions specified by ISO/IEC 24747:2009. */
#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
# undef __STDC_WANT_MATH_SPEC_FUNCS__
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
/* Enable X/Open extensions. Define to 500 only if necessary
to make mbstate_t available. */
#ifndef _XOPEN_SOURCE
# undef _XOPEN_SOURCE
#endif
@ -354,11 +425,6 @@
/* Enable zlib compression support */
#undef ZLIBSUPPORT
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
@ -368,16 +434,6 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
@ -411,7 +467,7 @@
/* Define to `long int' if <sys/types.h> does not define. */
#undef off_t
/* Define to `int' if <sys/types.h> does not define. */
/* Define as a signed integer type capable of holding a process identifier. */
#undef pid_t
/* Define to `unsigned int' if <sys/types.h> does not define. */

File diff suppressed because it is too large Load Diff

6981
contrib/file/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT([file],[5.42],[christos@astron.com])
AC_INIT([file],[5.43],[christos@astron.com])
AM_INIT_AUTOMAKE([subdir-objects foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -170,8 +170,9 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
@ -182,6 +183,7 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
@ -270,6 +272,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@ -500,7 +503,6 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am

View File

@ -1,5 +1,5 @@
.\" $File: magic.man,v 1.99 2021/05/09 22:37:23 christos Exp $
.Dd May 9, 2021
.\" $File: magic.man,v 1.100 2022/09/10 13:19:26 christos Exp $
.Dd September 10, 2022
.Dt MAGIC __FSECTION__
.Os
.\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
@ -359,6 +359,9 @@ For example the magic entries:
-0 offset <=100 must be more than 100 \e
bytes and is only %lld
.Ed
.It Dv octal
A string representing an octal number.
.El
.El
.Pp
For compatibility with the Single
@ -645,6 +648,7 @@ The following types are recognized:
.It i ID3 Little 4
.It I ID3 Big 4
.It m Middle Middle 4
.It o Octal Textual Variable
.It q Quad Little 8
.It Q Quad Big 8
.El

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: animation,v 1.88 2022/05/14 22:06:04 christos Exp $
# $File: animation,v 1.90 2022/08/16 11:16:39 christos Exp $
# animation: file(1) magic for animation/movie formats
#
# animation formats
@ -30,8 +30,6 @@
#!:mime image/x-quicktime
4 string pckg Apple QuickTime compressed archive
!:mime application/x-quicktime-player
4 string/W jP JPEG 2000 image
!:mime image/jp2
#### MP4 ####
# https://www.ftyps.com/ with local additions
@ -168,6 +166,7 @@
# ?/enc-isoff-generic
>8 string iso \b, MP4 Base Media
!:mime video/mp4
!:ext mp4
>>11 string m v1 [ISO 14496-12:2003]
>>11 string 2 v2 [ISO 14496-12:2005]
>>11 string 4 v4
@ -937,6 +936,7 @@
0 belong&0xFF5FFF10 0x47400010
>188 byte 0x47 MPEG transport stream data
!:mime video/MP2T
!:ext ts
# DIF digital video file format <mpruett@sgi.com>
0 belong&0xffffff00 0x1f070000 DIF

View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# $File: archive,v 1.162 2022/05/27 21:27:59 christos Exp $
# $File: archive,v 1.169 2022/09/12 13:13:28 christos Exp $
# archive: file(1) magic for archive formats (see also "msdos" for self-
# extracting compressed archives)
#
@ -25,7 +25,16 @@
>>>>>>155 ubyte&0xDF =0
# space or ascii digit 0 at start of check sum
>>>>>>>148 ubyte&0xEF =0x20
>>>>>>>>0 use tar-file
# FOR DEBUGGING:
#>>>>>>>>0 regex \^[0-9]{2,4}[.](png|jpg|jpeg|tif|tiff|gif|bmp) NAME "%s"
# check for 1st image main name with digits used for sorting
# and for name extension case insensitive like: PNG JPG JPEG TIF TIFF GIF BMP
>>>>>>>>0 regex \^[0-9]{2,4}[.](png|jpg|jpeg|tif|tiff|gif|bmp)
#foo
>>>>>>>>>0 use tar-cbt
# if 1st member name without digits and without used image suffix then it is a TAR archive
>>>>>>>>0 default x
>>>>>>>>>0 use tar-file
# minimal check and then display tar archive information which can also be
# embedded inside others like Android Backup, Clam AntiVirus database
0 name tar-file
@ -146,6 +155,19 @@
>>508 default x
# padding[255] in old tar sometimes comment field
>>>257 string >\0 \b, comment: %-.40s
# Summary: Comic Book Archive *.CBT with TAR format
# URL: https://en.wikipedia.org/wiki/Comic_book_archive
# http://fileformats.archiveteam.org/wiki/Comic_Book_Archive
# Note: there exist also RAR, ZIP, ACE and 7Z packed variants
0 name tar-cbt
>0 string x Comic Book archive, tar archive
#!:mime application/x-tar
!:mime application/vnd.comicbook
#!:mime application/vnd.comicbook+tar
!:ext cbt
# name[100] probably like: 19.jpg 0001.png 0002.png
# or maybe like ComicInfo.xml
>0 string >\0 \b, 1st image %-.60s
# Incremental snapshot gnu-tar format from:
# https://www.gnu.org/software/tar/manual/html_node/Snapshot-Files.html
@ -1724,13 +1746,17 @@
# Felix von Leitner <felix-file@fefe.de>
0 string d8:announce BitTorrent file
!:mime application/x-bittorrent
!:ext torrent
# Durval Menezes, <jmgthbfile at durval dot com>
0 string d13:announce-list BitTorrent file
!:mime application/x-bittorrent
!:ext torrent
0 string d7:comment BitTorrent file
!:mime application/x-bittorrent
!:ext torrent
0 string d4:info BitTorrent file
!:mime application/x-bittorrent
!:ext torrent
# Atari MSA archive - Teemu Hukkanen <tjhukkan@iki.fi>
# URL: http://fileformats.archiveteam.org/wiki/MSA_(Magic_Shadow_Archiver)
@ -2081,3 +2107,6 @@
# URL: http://mattmahoney.net/dc/#paq9a
# Note: Line 1186 of paq9a.cpp gives the magic bytes
0 string pQ9\001 PAQ9A archive
# From wof (wof@stachelkaktus.net)
0 string Unison\ archive\ format Unison archive format

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: audio,v 1.121 2021/04/26 15:56:00 christos Exp $
# $File: audio,v 1.124 2022/08/28 08:58:20 christos Exp $
# audio: file(1) magic for sound formats (see also "iff")
#
# Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
@ -403,10 +403,26 @@
0 string THX AHX version
>3 byte =0 1 module data
>3 byte =1 2 module data
>10 byte x TRL: %u
>11 byte x TRK: %u
>12 byte x SMP: %u
>13 byte x SS: %u
>11 ubyte x TRK: %u
>10 ubyte x TRL: %u
>12 ubyte x SMP: %u
>13 ubyte x SS: %u
>(4.H) string x Title: "%.128s"
# header is mostly AHX format
0 string HVL
>3 byte <2 Hively Tracker Song
>3 byte =0 v1 module data
>3 byte =1 v2 module data
>11 ubyte x TRK: %u
>10 ubyte x TRL: %u
>12 ubyte x SMP: %u
>13 ubyte x SS: %u
>8 ubyte/4 =0 CHN: 4
>8 ubyte/4 >0 CHN: 4+%u
#>-0 offset <0xffff
>(4.H) string x Title: "%.128s"
#
0 string OKTASONG Oktalyzer module data
#
@ -548,15 +564,13 @@
# From: Alex Myczko <alex@aiei.ch>
# https://github.com/rerrahkr/BambooTracker
0 string BambooTrackerMod BambooTracker module
>22 byte x \b, version %u
>21 byte x \b.%u
>20 byte x \b.%u
0 string BambooTrackerIst BambooTracker instrument
>22 byte x \b, version %u
>21 byte x \b.%u
>20 byte x \b.%u
0 string BambooTracker BambooTracker
>13 string Mod Module
>13 string Ist Instrument
>13 string Bnk Bank
>22 byte x \b, version %u
>21 byte x \b.%u
>20 byte x \b.%u
0 string CC2x CheeseCutter 2 song
@ -894,11 +908,6 @@
>0x3 byte&0x0F x \b%02d
>>0x4 string >\0 title: "%s"
0 string HVL
>3 byte <2 Hively Tracker Song
>3 byte 0 1 module data
>3 byte 1 2 module data
0 string MO3
>3 ubyte <6 MOdule with MP3
>>3 byte 0 Version 0 (With MP3 and lossless)
@ -1136,3 +1145,132 @@
>>0 use nintendo-3ds-bcwav-fields
>4 beshort 0xFEFF
>>0 use \^nintendo-3ds-bcwav-fields
# Philips DSDIFF audio format (Direct Stream Digital Interchange File Format)
# Used for DSD audio recordings and Super Audio CD (SACD) mastering annotations
# https://dsd-guide.com/sites/default/files/white-papers/DSDIFF_1.5_Spec.pdf
# From: Toni Ruottu <toni.ruottu@iki.fi>
0 string FRM8
12 string DSD\x20 DSDIFF audio bitstream data
!:mime audio/x-dff
!:ext dff
# format version chunk
>&0 string FVER
# version 1
>>&8 byte 1
# v1 / sampling resolution ( 1 bit PDM only )
>>>&0 string x \b, 1 bit
# v1 / sound property chunk
>>>&0 search/0xff PROP
>>>>&8 string SND
# v1 / sound property chunk / channel configuration chunk
>>>>>&0 search/0xff CHNL
>>>>>>&8 ubeshort 1 \b, mono
>>>>>>&8 ubeshort 2
>>>>>>>&0 string SLFTSRGT \b, stereo
>>>>>>>&0 default x \b, 2 channels
>>>>>>&8 ubeshort 3
>>>>>>>&0 string SLFTSRGTLFE\x20 \b, 2.1 stereo
>>>>>>>&0 string SLFTSRGTC\x20\x20\x20 \b, 3.0 stereo
>>>>>>>&0 default x \b, 3 channels
>>>>>>&8 ubeshort 4
>>>>>>>&0 string MLFTMRGTLS\x20\x20RS\x20\x20 \b, 4.0 surround
>>>>>>>&0 string SLFTSRGTC\x20\x20\x20LFE\x20 \b, 3.1 stereo
>>>>>>>&0 default x \b, 4 channels
>>>>>>&8 ubeshort 5
>>>>>>>&0 string MLFTMRGTC\x20\x20\x20LS\x20\x20RS\x20\x20 \b, 5.0 surround
>>>>>>>&0 string MLFTMRGTLFE\x20LS\x20\x20RS\x20\x20 \b, 4.1 surround
>>>>>>>&0 default x \b, 5 channels
>>>>>>&8 ubeshort 6
>>>>>>>&0 string MLFTMRGTC\x20\x20\x20LFE\x20LS\x20\x20RS\x20\x20 \b, 5.1 surround
>>>>>>>&0 default x \b, 6 channels
>>>>>>&8 ubeshort >6 \b, %u channels
# v1 / sound property chunk / sample rate chunk
>>>>>&0 search/0xff FS\x20\x20
>>>>>>&0 string x \b,
>>>>>>&8 ubelong%44100 0
>>>>>>>&-4 ubelong/44100 x "DSD %u"
>>>>>>>&-4 ubelong x %u Hz
# v1 / sound property chunk / compression type chunk
>>>>>&0 search/0xff CMPR
>>>>>>&8 string DSD\x20 \b, no compression
>>>>>>&8 string DST\x20 \b, DST compression
>>>>>>&8 default x \b, unknown compression
# v1 / quest for metadata
>>>&0 string x
# v1 / quest for metadata / edited master information chunk
>>>>&0 search DIIN
>>>>>&0 ubequad >0 \b, "edited master" metadata
# v1 / quest for metadata / ID3 chunk ( defacto standard )
>>>>&0 search ID3\x20
>>>>>&8 string ID3 \b, ID3 version 2
>>>>>&0 byte x \b.%u
>>>>>&1 byte x \b.%u
# v1 / quest for metadata / failure ( possibly due to -P bytes=... being too low )
>>>>&0 default x \b, ID3 missing (or unreachable)
# version > 1 or 0
>>&0 default x \b, unknown version
# Sony DSF audio format (Direct Stream Digital Stream File)
# Used for lossless digital storage of songs produced as DSD audio
# Portable analog of a track stored on a Super Audio CD (SACD)
# https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf
# From: Toni Ruottu <toni.ruottu@iki.fi>
0 string DSD\x20 DSF audio bitstream data
!:mime audio/x-dsf
!:ext dsf
# format chunk
>28 string fmt\x20
# version 1
>>&8 ulelong 1
# v1 / sampling resolution ( 1 bit PDM only )
# NOTE: the spec incorrectly uses "bits per sample" instead of "bits per byte"
>>>&0 string x \b, 1 bit
# v1 / channel configuration
>>>>&4 ulelong 1 \b, mono
>>>>&4 ulelong 2 \b, stereo
>>>>&4 ulelong 3 \b, 3.0 stereo
>>>>&4 ulelong 4 \b, 4.0 surround
>>>>&4 ulelong 5 \b, 3.1 stereo
>>>>&4 ulelong 6 \b, 5.0 surround
>>>>&4 ulelong 7 \b, 5.1 surround
>>>>&0 default x
>>>>>&4 ulelong x \b, %u channels
# v1 / sample rate chunk
>>>>&0 string x \b,
>>>>&12 ulelong%44100 0
>>>>>&-4 ulelong/44100 x "DSD %u"
>>>>&12 ulelong x %u Hz
# v1 / compression
>>>>&0 string x
>>>>>&0 ulelong 0 \b, no compression
>>>>>&0 default x \b, unknown compression
# v1 / embedded ID3v2 metadata
>>>0 string x \b, ID3
>>>>20 ulequad !0
>>>>>(20.q) string ID3 version 2
>>>>>>&0 byte x \b.%u
>>>>>>&1 byte x \b.%u
# unable to verify ID3 ( possibly due to -P bytes=... being too low )
>>>>>&0 default x unreachable
>>>>&0 default x missing
# version > 1 or 0
>>&0 default x \b, unknown version

View File

@ -0,0 +1,7 @@
#------------------------------------------------------------
# $File: burp,v 1.1 2022/07/04 17:15:09 christos Exp $
# Burp file, I don't know the version
#------------------------------------------------------------
# From wof (wof@stachelkaktus.net)
0 bequad 0x6685828000000001 Burp project save file

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: cafebabe,v 1.27 2021/04/26 15:56:00 christos Exp $
# $File: cafebabe,v 1.28 2022/07/01 23:24:47 christos Exp $
# Cafe Babes unite!
#
# Since Java bytecode and Mach-O universal binaries have the same magic number,
@ -44,6 +44,12 @@
>>4 belong 0x0038 (Java SE 12)
>>4 belong 0x0039 (Java SE 13)
>>4 belong 0x003A (Java SE 14)
>>4 belong 0x003B (Java SE 15)
>>4 belong 0x003C (Java SE 16)
>>4 belong 0x003D (Java SE 17)
>>4 belong 0x003E (Java SE 18)
>>4 belong 0x003F (Java SE 19)
>>4 belong 0x0040 (Java SE 20)
# pool count unequal zero
#>>8 beshort x \b, pool count %#x
# pool table

View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# $File: compress,v 1.82 2021/06/30 08:11:29 christos Exp $
# $File: compress,v 1.83 2022/08/16 11:16:39 christos Exp $
# compress: file(1) magic for pure-compression formats (no archives)
#
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
@ -147,6 +147,7 @@
# bzip2
0 string BZh bzip2 compressed data
!:mime application/x-bzip2
!:ext bz2
>3 byte >47 \b, block size = %c00k
# bzip a block-sorting file compressor

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: database,v 1.66 2022/02/26 17:42:21 christos Exp $
# $File: database,v 1.67 2022/07/12 18:57:42 christos Exp $
# database: file(1) magic for various databases
#
# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
@ -408,8 +408,10 @@
>>>>>>>>>0 ulelong <0x400000
# skip WinStore.App.exe by looking for printable 2nd character of 1st memo item
>>>>>>>>>>513 ubyte >037
# skip DOS executables CPQ0TD.DRV E30ODI.COM IBM0MONO.DRV by looking for printable 1st character of 1st memo item
>>>>>>>>>>>512 ubyte >037
# unusual dBASE III DBT like adressen.dbt
>>>>>>>>>>>0 use dbase3-memo-print
>>>>>>>>>>>>0 use dbase3-memo-print
# dBASE III DBT like angest.dbt, or garbage PCX DBF
>>>>>>>>8 ubelong !0
# skip PCX and some DBF by test for for reserved NULL bytes

View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# $File: der,v 1.4 2021/03/14 17:12:04 christos Exp $
# $File: der,v 1.5 2022/07/30 18:07:34 christos Exp $
# der: file(1) magic for DER encoded files
#
@ -110,9 +110,9 @@
>>>>&0 der seq
>>>>>&0 der obj_id9=2a864886f70d010901
>>>>>&0 der ia5_str=x \b, emailAddress=%s
>>&0 der seq
>>>&0 der utc_time=x \b, utcTime=%s
>>>&0 der utc_time=x \b, utcTime=%s
#>>&0 der seq
#>>>&0 der utc_time=x \b, utcTime=%s
#>>>&0 der utc_time=x \b, utcTime=%s
>>&0 use certinfo
0 der seq
@ -129,9 +129,9 @@
>>>>&0 der seq
>>>>>&0 der obj_id3=550403
>>>>>&0 der utf8_str=x \b, Issuer=%s
>>&0 der seq
>>>&0 der utc_time=x \b, not-valid-before=%s
>>>&0 der utc_time=x \b, not-valid-after=%s
#>>&0 der seq
#>>>&0 der utc_time=x \b, not-valid-before=%s
#>>>&0 der utc_time=x \b, not-valid-after=%s
>>&0 der seq
>>>&0 der set
>>>>&0 der seq

View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# $File: filesystems,v 1.149 2022/05/21 22:50:28 christos Exp $
# $File: filesystems,v 1.150 2022/07/04 16:40:33 christos Exp $
# filesystems: file(1) magic for different filesystems
#
0 name partid
@ -2661,3 +2661,29 @@
>>>&(0x107a.b*56) use bcachefs-uuid
>>0x107b byte x \b, %d devices
>>0x1090 byte ^0x02 \b (unclean)
# EROFS
# https://kernel.googlesource.com/pub/scm/linux/kernel/git/xiang/erofs-utils/\
# +/refs/heads/experimental/include/erofs_fs.h#12
1024 lelong 0xE0F5E1E2 EROFS filesystem
#>1028 lelong x \b, checksum=%#x
>1032 lelong >0 \b, compat:
>>1032 lelong &1 SB_CHKSUM
>>1032 lelong &2 MTIME
>1036 byte x \b, blocksize=%u
>1037 byte x \b, exslots=%u
#>1038 leshort x \b, root_nid=%d
#>1040 lequad x \b, inodes=%ld
#>1048 leldate x \b, build_time=%s
#>1056 lelong x \b.%d
#>1060 lelong x \b, blocks=%d
#>1064 lelong x \b, metadata@%#x
#>1068 lelong x \b, xattr@%#x
>1072 guid x \b, uuid=%s
>1088 string >0 \b, name=%s
>1104 lelong >0 \b, incompat:
>>1104 lelong &1 LZ4_0PADDING
>>1104 lelong &2 BIG_PCLUSTER
>>1104 lelong &4 CHUNKED_FILE
>>1104 lelong &8 DEVICE_TABLE
>>1104 lelong &16 ZTAILPACKING

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: fonts,v 1.50 2022/03/21 21:28:13 christos Exp $
# $File: fonts,v 1.51 2022/08/16 11:16:39 christos Exp $
# fonts: file(1) magic for font data
#
0 search/1 FONT ASCII vfont text
@ -442,6 +442,7 @@
# https://www.w3.org/TR/WOFF2/
0 string wOF2 Web Open Font Format (Version 2)
!:mime font/woff2
!:ext woff2
>0 use woff
#>20 belong x \b, totalCompressedSize %d
>24 beshort x \b, version %d

View File

@ -0,0 +1,80 @@
#------------------------------------------------------------------------------
# $File: gentoo,v 1.2 2022/09/12 13:13:28 christos Exp $
# gentoo: file(1) magic for gentoo specific formats
#
# Summary: Gentoo ebuild Manifest files (GLEP 74)
# Reference: https://www.gentoo.org/glep/glep-0074.html
# Submitted by: Michal Gorny <mgorny@gentoo.org>
# Start by doing a fast check for the most common tags.
0 string AUX
>0 use gentoo-manifest
0 string DATA
>0 use gentoo-manifest
0 string DIST
>0 use gentoo-manifest
0 string EBUILD
>0 use gentoo-manifest
0 string MANIFEST
>0 use gentoo-manifest
# Manifest can be PGP-signed.
0 string -----BEGIN\040PGP\040SIGNED\040MESSAGE-----
>34 search/32 \n\n
>>&0 string AUX
>>>&0 use gentoo-manifest
>>&0 string DATA
>>>&0 use gentoo-manifest
>>&0 string DIST
>>>&0 use gentoo-manifest
>>&0 string EBUILD
>>>&0 use gentoo-manifest
>>&0 string MANIFEST
>>>&0 use gentoo-manifest
# Use a more detailed regex to verify that we were correct.
# <tag> <filename> <size> <hash-name> <hash-value>...
# (<tag>'s already been matched prior to calling)
0 name gentoo-manifest
>&0 regex [[:space:]]+[[:print:]]+[[:space:]]+[[:digit:]]+[[:space:]]+[[:alnum:]]+[[:space:]]+[[:xdigit:]]{32} Gentoo Manifest (GLEP 74)
# Summary: Gentoo ebuild and eclass files
# Reference: https://projects.gentoo.org/pms/8/pms.html
# Submitted by: Michal Gorny <mgorny@gentoo.org>
0 search/512 EAPI=
>0 regex .*\n[\040\t]*EAPI=["']? Gentoo ebuild
>>&0 regex [[:alnum:]+_.-]+ \b, EAPI %s
0 search/512 @ECLASS:\040 Gentoo eclass
>&0 string x %s
# Summary: Gentoo supplementary package and category metadata files
# Reference: https://www.gentoo.org/glep/glep-0068.html
# Submitted by: Michal Gorny <mgorny@gentoo.org>
0 string \<?xml
>0 search/512 \<catmetadata Gentoo category metadata file
>0 search/512 \<pkgmetadata Gentoo package metadata file
# Summary: Gentoo GLEP 78 binary package
# Reference: https://www.gentoo.org/glep/glep-0078.html
# Note: assumes the strict format
# Submitted by: Michal Gorny <mgorny@gentoo.org>
# GPKG uses ustar (or ustar-compatible GNU format) that starts with
# a <directory>/gpkg-1 file
257 string ustar
>0 search/100 /gpkg-1\0
>>0 regex [^/]+ Gentoo GLEP 78 (GPKG) binary package for "%s"
!:mime application/x-tar
!:ext tar
# the logic below requires the gpkg-1 file to be empty
>>>124 string 00000000000\0
# determine the compression used by looking at the second member name
>>>>512 search/100 .tar.
>>>>>&0 string gz\0 using gzip compression
>>>>>&0 string bz2\0 using bzip2 compression
>>>>>&0 string lz\0 using lzip compression
>>>>>&0 string lz4\0 using lz4 compression
>>>>>&0 string lzo\0 using lzo compression
>>>>>&0 string xz\0 using xz compression
>>>>>&0 string zst\0 using zstd compression
>>>>(636.o+1024) search/611 .sig\0 \b, signed

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: images,v 1.223 2022/05/14 20:05:09 christos Exp $
# $File: images,v 1.227 2022/09/11 20:58:52 christos Exp $
# images: file(1) magic for image formats (see also "iff", and "c-lang" for
# XPM bitmaps)
#
@ -365,7 +365,7 @@
>>>8 default x
>>>>8 uleshort x \b(unknown %#x)
>>>12 use tiff_entry
>0 uleshort 0x106 \b, PhotometricIntepretation=
>0 uleshort 0x106 \b, PhotometricInterpretation=
>>8 clear x
>>8 uleshort 0 \bWhiteIsZero
>>8 uleshort 1 \bBlackIsZero
@ -1458,7 +1458,25 @@
>2 quad !0
# skip g3test.g3 by test for unused bits of 2nd color entry
>>4 ubeshort&0xF000 0
>>>0 use degas-bitmap
#>>>0 beshort x 1ST_VALUE=%x
>>>-0 offset x FILE_SIZE=%lld
# standard DEGAS low-res uncompressed bitmap *.pi1 with file size 32034
>>>-0 offset =32034 VARIANT_STANDARD
#>>>>0 beshort x 1st_VALUE=%x
# like: 8ball.pi1 teddy.pi1 sonic01.pi1
>>>>0 use degas-bitmap
# about 61 DEGAS Elite low-res uncompressed bitmap *.pi1 with file size 32066
>>>-0 offset =32066 VARIANT_ELITE
# like: spider.pi1 pinkgirl.pi1 frog3.pi1
>>>>0 use degas-bitmap
# about 55 DEGAS Elite low-res uncompressed bitmap *.pi1 with file size 32128
>>>-0 offset =32128 VARIANT_3
# like: mountain.pi1 bigspid.pi1 alf33.pi1
>>>>0 use degas-bitmap
# 1 DEGAS Elite low-res uncompressed bitmap *.pi1 with file size 44834
>>>-0 offset =44834 VARIANT_4
# like: kenshin.pi1
>>>>0 use degas-bitmap
# DEGAS mid-res uncompressed bitmap *.pi2 (strength=50) after GEM Images like:
# BEETHVEN.IMG CHURCH.IMG GAMEOVR4.IMG TURKEY.IMG clinton.img
0 beshort 0x0001
@ -2210,10 +2228,104 @@
# height (80,90)
>>0x53 uleshort x \b%d
# From: Joerg Jenderek
# URL: http://fileformats.archiveteam.org/wiki/Imageiio/imaginfo_(Ulead)
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/p/pe3.trid.xml
# Note: called "Ulead Imageiio/Imaginfo thumbnail" by TrID
0 string IIO1$ Ulead Photo Explorer 3
#!:mime application/octet-stream
!:mime image/x-ulead-pe3
# IMAGEIIO.PE3
!:ext pe3
# look for DOS/Windows drive letter
>5 search/192/s :\\
# directory or full name of corresponding imaginfo.pe3 like: "T:\SAMPLES\TEXTURES\SKY_SNOW\IIOE371.TMP "S:\PI3\PIMPACT3\PROGRAMS\PATTERNS\imaginfo.pe3"
>>&-1 string x "%s"
# look for DOS/Windows network path if no drive letter part
>5 default x
>>5 search/192/s \x5c\x5c
# full name of corresponding imaginfo.pe3 like: "\\Lionking\upi\SAMPLES\IMAGES\ANIMALS\imaginfo.pe3"
>>>&0 string x "%s"
# Type: Ulead Photo Explorer5 (.pe5)
# URL: http://www.jisyo.com/cgibin/view.cgi?EXT=pe5 (Japanese)
# URL: http://fileformats.archiveteam.org/wiki/Imageiio/imaginfo_(Ulead)
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/p/pe4.trid.xml
# From: Simon Horman <horms@debian.org>
0 string IIO2H Ulead Photo Explorer5
# Update: Joerg Jenderek
# Note: some called "Ulead Imageiio/Imaginfo thumbnail" by TrID
# and used in various Ulead applications
0 string IIO2H Ulead Photo Explorer 4 or 5
#!:mime application/octet-stream
!:mime image/x-ulead-pe4
# IMAGEIIO.PE4
!:ext pe4/pe5
# look in most samples for JPEG signature like: SAMPLES/IMAGES/SCENES/IMAGINFO.PE4
>0x4c2 search/0xE02/s JFIF with JPEG image data
>>&-6 use jpeg
# near the end list of image names like: Img0001.pcd 1116012L.JPG NCARD4.TPL
#
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/p/pe3-imaginfo.trid.xml
11 string \001\0\0\0\0
# check for version 3 part
>19 string \0\001\0\003\0
>>0 use ulead-imaginfo
# From: Joerg Jenderek
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/p/pe4-imaginfo.trid.xml
11 string \001\0\0\0\0
# check for version 4 part
>19 string \0\0\0\004\0
>>0 use ulead-imaginfo
# display information about Ulead Imaginfo thumbnail (version, directory, image extension)
0 name ulead-imaginfo
>22 ubyte x Ulead Imaginfo thumbnail
#!:mime application/octet-stream
!:mime image/x-ulead-imaginfo
>22 ubyte =3 \b, version 3
# IMAGINFO.PE3
!:ext pe3
>22 ubyte =4 \b, version 4
# IMAGINFO.PE4
!:ext pe4
# MAYBE ALSO VERSION 5 ?
#>22 ubyte =5 \b, version 5
#!:ext pe5
>22 ubyte x
# look for DOS/Windows driver letter
>>4 search/192/s :\x5c
# skip f:\Programme\iPhoto Plus 4\Template\Business Cards\IMAGINFO.PE4
# by looking for driver letter in range A-Z
>>>&-1 ubyte >0x40
# directory path like: "E:\iPE\CDSample\Images\Scenes" "D:\XmasCard\Samples" "C:\TEMP\PLANTS"
>>>>&-5 pstring/l >0 \b, "%s"
# look for DOS/Windows network path if no valid drive letter part
>>>&-1 default x
>>>>4 search/192/s \x5c\x5c
# directory path like: "\\FSX\SYS\OPPS\IPE.ENG\TEMPLATE\BUSINESS" "\\Lionking\upi\SAMPLES\IMAGES\ANIMALS"
>>>>>&-4 pstring/l >0 \b, "%s"
# look for DOS/Windows network path if no drive letter part
>>4 default x
>>>4 search/192/s \x5c\x5c
# directory path like: "\\FSX\SYS\opps\ipe.eng\samples" "\\DANIEL\IPE_CD\IPE.ITA"
>>>>&-4 pstring/l >0 \b, "%s"
# look for point character inside image names
>56 search/38/s .
# image name extension like: bmp jpg pcd tpl
>>&1 string x with %-.3s images
# Summary: Ulead Pattern image (Corel Corporation)
# URL: https://en.wikipedia.org/wiki/Ulead_Systems
# https://www.file-extensions.org/pst-file-extension-ulead-pattern-image-format
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/p/pst-ulead.trid.xml
# From: Joerg Jenderek
# Note: used also by CorelDraw Essentials 3 version 13.0.0.800
# there seems to exist other versions
0 ubelong 0xFFFF0100
>8 search/21 PresetInfo Ulead pattern image
#!:mime application/octet-stream
!:mime image/x-ulead-pst
!:ext pst
# string length like: 16 18 19 21 24
#>>4 uleshort x n=%u
# like: BlendPresetInfo DropShadowPresetInfo FileNewPresetInfo VectorExtrudePresetInfo EnvelopePresetInfo ContourPresetInfo DistortionPresetInfo
>>4 pstring/h x "%s"
# Type: X11 cursor
# URL: http://webcvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml.in?view=markup
@ -3814,3 +3926,14 @@
>0x24 ulelong 1 \b, embedded PNG image
>0x24 ulelong 2 \b, embedded WebP image
>0x24 ulelong 3 \b, Basis Universal
# Summary: iCEDraw graphic *.IDF
# URL: http://fileformats.archiveteam.org/wiki/ICEDraw
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/i/idf-icedraw.trid.xml
# From: Joerg Jenderek
# Note: called "iCEDraw graphic" by TrID, "iCEDraw text" by FFmpeg and "iCE Draw" by Ansilove
# verified by FFmpeg command `ffprobe ICE-9605.IDF` and `ansilove -s SQ-FORCE.IDF`
0 string \0041.4\0\0\0\0O\0 iCEDraw graphic
#!:mime application/octet-stream
!:mime image/x-idf
!:ext idf

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: javascript,v 1.3 2021/12/08 13:42:00 christos Exp $
# $File: javascript,v 1.4 2022/09/02 08:08:17 christos Exp $
# javascript: magic for javascript and node.js scripts.
#
0 string/w #!/bin/node Node.js script text executable
@ -20,3 +20,102 @@
# BCGen/HBC/BytecodeFileFormat.h#L24
0 lequad 0x1F1903C103BC1FC6 Hermes JavaScript bytecode
>8 lelong x \b, version %d
# v8 JavaScript engine bytecode
# From: Alexandre Iooss <erdnaxe@crans.org>
# URL: https://v8.dev/docs/ignition
# Note: used in bytenode and NW.js protected source code
# V8 bytecode extraction was added in NodeJS v5.7.0 (V8 4.6.85.31).
# Version information is provided for some v8 versions found in NodeJS releases.
2 uleshort =0xC0DE
>0 ulelong^0xC0DE0000 >0
# Reservation table starts at 40
>>40 ulelong&0xFFFFFF00 =0x80000000
# Stub keys present
>>>24 ulelong >0
>>>>0 ulelong^0xC0DE0000 x v8 bytecode, external reference table size: %u bytes,
>>>>4 ulelong =0xEE4BF478 version 5.1.281.111,
>>>>4 ulelong =0xC4A0100C version 5.5.372.43,
>>>>8 ulelong x source size: %u bytes,
>>>>12 ulelong x cpu features: %#08X,
>>>>16 ulelong x flag hash: %#08X,
>>>>20 ulelong x %u reservations,
>>>>28 ulelong x payload size: %u bytes,
>>>>32 ulelong x checksum1: %#08X,
>>>>36 ulelong x checksum2: %#08X
# No stub keys
>>>24 ulelong =0
>>>>0 ulelong^0xC0DE0000 x v8 bytecode, external reference table size: %u bytes,
>>>>4 ulelong =0x54F0AD81 version 6.2.414.46,
>>>>4 ulelong =0X7D1BF182 version 6.2.414.54,
>>>>4 ulelong =0x35BA122E version 6.2.414.77,
>>>>4 ulelong =0X9319F9C2 version 6.2.414.78,
>>>>4 ulelong =0xB1240060 version 6.6.346.32,
>>>>4 ulelong =0x2B757060 version 6.7.288.46,
>>>>4 ulelong =0x09D147AA version 6.7.288.49,
>>>>4 ulelong =0xF4D4F48A version 6.8.275.32,
>>>>4 ulelong =0xD3961326 version 7.0.276.38,
>>>>8 ulelong x source size: %u bytes,
>>>>12 ulelong x cpu features: %#08X,
>>>>16 ulelong x flag hash: %#08X,
>>>>20 ulelong x %u reservations,
>>>>28 ulelong x payload size: %u bytes,
>>>>32 ulelong x checksum1: %#08X,
>>>>36 ulelong x checksum2: %#08X
# Reservation table starts at 32
>>32 ulelong&0xFFFFFF00 =0x80000000
# Second checksum present
>>>28 ulelong >0
>>>>0 ulelong^0xC0DE0000 x v8 bytecode, external reference table size: %u bytes,
>>>>4 ulelong =0x21DDF627 version 7.4.288.21,
>>>>4 ulelong =0x1FC9FE84 version 7.4.288.27,
>>>>4 ulelong =0x60A99E8B version 7.5.288.22,
>>>>4 ulelong =0x4F665E90 version 7.6.303.29,
>>>>4 ulelong =0xC7ACFCDE version 7.7.299.11,
>>>>4 ulelong =0x7F641D8F version 7.7.299.13,
>>>>4 ulelong =0xFD9A4F2E version 7.8.279.17,
>>>>4 ulelong =0x3A845324 version 7.8.279.23,
>>>>4 ulelong =0xFF52FEAF version 7.9.317.25,
>>>>8 ulelong x source size: %u bytes,
>>>>12 ulelong x flag hash: %#08X,
>>>>16 ulelong x %u reservations,
>>>>20 ulelong x payload size: %u bytes,
>>>>24 ulelong x checksum1: %#08X,
>>>>28 ulelong x checksum2: %#08X
# No second checksum
>>>28 ulelong =0
>>>>0 ulelong^0xC0DE0000 x v8 bytecode, external reference table size: %u bytes,
>>>>4 ulelong =0x8725E0F8 version 8.1.307.30,
>>>>4 ulelong =0x09ED1289 version 8.1.307.31,
>>>>4 ulelong =0xA5728C87 version 8.3.110.9,
>>>>4 ulelong =0xB45C5D30 version 8.4.371.23,
>>>>4 ulelong =0xED9C278B version 8.4.371.19,
>>>>4 ulelong =0xD27BFF42 version 8.6.395.16,
>>>>8 ulelong x source size: %u bytes,
>>>>12 ulelong x flag hash: %#08X,
>>>>16 ulelong x %u reservations,
>>>>20 ulelong x payload size: %u bytes,
>>>>24 ulelong x payload checksum: %#08X
# No reservation table and code starts at 24
>>32 ulelong =0
>>>0 ulelong^0xC0DE0000 x v8 bytecode, external reference table size: %u bytes,
>>>4 ulelong =0x9A6F0B0F version 9.0.257.17,
>>>4 ulelong =0x271D5D1E version 9.0.257.24,
>>>4 ulelong =0x4EEA75DF version 9.0.257.25,
>>>4 ulelong =0x80809479 version 9.1.269.36,
>>>4 ulelong =0x55C46F65 version 9.1.269.38,
>>>4 ulelong =0x8A9C758A version 9.2.230.21,
>>>4 ulelong =0x9712F0E1 version 9.3.345.16,
>>>4 ulelong =0x29593715 version 9.4.146.19,
>>>4 ulelong =0xCD991825 version 9.4.146.24,
>>>4 ulelong =0xACDD64EE version 9.4.146.26,
>>>4 ulelong =0xC96B4CD5 version 9.5.172.21,
>>>4 ulelong =0xBCCE4578 version 9.5.172.25,
>>>4 ulelong =0xA2EEA077 version 9.6.180.15,
>>>4 ulelong =0xFD350011 version 10.1.124.8,
>>>4 ulelong =0xBEF4028F version 10.2.154.13,
>>>4 ulelong =0xAF632352 version 10.2.154.4,
>>>8 ulelong x source size: %u bytes,
>>>12 ulelong x flag hash: %#08X,
>>>16 ulelong x payload size: %u bytes,
>>>20 ulelong x payload checksum: %#08X

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: jpeg,v 1.36 2021/08/28 12:30:52 christos Exp $
# $File: jpeg,v 1.37 2022/06/17 18:03:35 christos Exp $
# JPEG images
# SunOS 5.5.1 had
#
@ -103,43 +103,152 @@
#>>(2.S+2) use jpeg_segment
# HSI is Handmade Software's proprietary JPEG encoding scheme
# Update: Joerg Jenderek
# URL: http://fileformats.archiveteam.org/wiki/HSI_JPEG
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-hsi1.trid.xml
# Note: called by TrID "HSI JPEG bitmap"
0 string hsi1 JPEG image data, HSI proprietary
#!:mime application/octet-stream
!:mime image/x-hsi
!:ext hsi/jpg
# From: David Santinoli <david@santinoli.com>
0 string \x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A JPEG 2000
# delete from ./animation (version 1.87) with jP (=6A50h) magic at offset 4
# From: Johan van der Knijff <johan.vanderknijff@kb.nl>
# Added sub-entries for JP2, JPX, JPM and MJ2 formats; added mimetypes
# https://github.com/bitsgalore/jp2kMagic
#
# Now read value of 'Brand' field, which yields a few possibilities:
# Update: Joerg Jenderek
# URL: http://fileformats.archiveteam.org/wiki/JP2
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jpeg2k.trid.xml
# Note: called by TrID "JPEG 2000 bitmap"
>20 string \x6a\x70\x32\x20 Part 1 (JP2)
# aliases image/jpeg2000, image/jpeg2000-image, image/x-jpeg2000-image
!:mime image/jp2
!:ext jp2
# URL: http://fileformats.archiveteam.org/wiki/JPX
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jpx.trid.xml
# Note: called by TrID "JPEG 2000 eXtended bitmap"
>20 string \x6a\x70\x78\x20 Part 2 (JPX)
!:mime image/jpx
!:ext jpf/jpx
# URL: http://fileformats.archiveteam.org/wiki/JPM
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jpm.trid.xml
# Note: called by TrID "JPEG 2000 eXtended bitmap"
>20 string \x6a\x70\x6d\x20 Part 6 (JPM)
!:mime image/jpm
!:ext jpm
# URL: http://fileformats.archiveteam.org/wiki/MJ2
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/v/video-mj2.trid.xml
# Note: called by TrID "Motion JPEG 2000 video"
>20 string \x6d\x6a\x70\x32 Part 3 (MJ2)
!:mime video/mj2
!:ext mj2/mjp2
# Type: JPEG 2000 codesream
# From: Mathieu Malaterre <mathieu.malaterre@gmail.com>
# Update: Joerg Jenderek
# URL: http://fileformats.archiveteam.org/wiki/JPEG_2000_codestream
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jpc.trid.xml
# Note: called by TrID "JPEG-2000 Code Stream bitmap"
0 belong 0xff4fff51 JPEG 2000 codestream
45 beshort 0xff52
# value like: 0701h FF50h
#>45 ubeshort x \b, at 45 %#4.4x
#!:mime application/octet-stream
# https://reposcope.com/mimetype/image/x-jp2-codestream
!:mime image/x-jp2-codestream
!:ext jpc/j2c/j2k
# MAYBE also JHC like in byte_causal.jhc ?
# WHAT IS THAT? DEAD ENTRY?
#45 beshort 0xff52
# JPEG extended range
# URL: http://fileformats.archiveteam.org/wiki/JPEG_XR
# Reference: https://www.itu.int/rec/T-REC-T.832
# http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-wmp.trid.xml
# Note: called by TrID "JPEG XR bitmap"
0 string \x49\x49\xbc
# FILE_VERSION_ID; shall be equal to 1; other values are reserved for future use
>3 byte 1
# FIRST_IFD_OFFSET; shall be an integer multiple of 2; so skip DROID fmt-590-signature-id-931.wdp
>>4 lelong%2 0 JPEG-XR
#!:mime image/vnd.ms-photo
!:mime image/jxr
!:ext jxr
# NO example for HDP !
!:ext jxr/wdp/hdp
# MAYBE also WMP ?
#!:ext jxr/wdp/hdp/wmp
# moved from ./images (version 1.205 ), merged and
# partly verified by XnView `nconvert -info abydos.jxr FLOWER.wdp`
# example: https://web.archive.org/web/20160403012904/
# http://shikino.co.jp/solution/upfile/FLOWER.wdp.zip
>90 bequad 0x574D50484F544F00
>>98 byte&0x08 =0x08 \b, hard tiling
>>99 byte&0x80 =0x80 \b, tiling present
>>99 byte&0x40 =0x40 \b, codestream present
>>99 byte&0x38 x \b, spatial xform=
>>99 byte&0x38 0x00 \bTL
>>99 byte&0x38 0x08 \bBL
>>99 byte&0x38 0x10 \bTR
>>99 byte&0x38 0x18 \bBR
>>99 byte&0x38 0x20 \bBT
>>99 byte&0x38 0x28 \bRB
>>99 byte&0x38 0x30 \bLT
>>99 byte&0x38 0x38 \bLB
>>100 byte&0x80 =0x80 \b, short header
>>>102 beshort+1 x \b, %d
>>>104 beshort+1 x \bx%d
>>100 byte&0x80 =0x00 \b, long header
>>>102 belong+1 x \b, %x
>>>106 belong+1 x \bx%x
>>101 beshort&0xf x \b, bitdepth=
>>>101 beshort&0xf 0x0 \b1-WHITE=1
>>>101 beshort&0xf 0x1 \b8
>>>101 beshort&0xf 0x2 \b16
>>>101 beshort&0xf 0x3 \b16-SIGNED
>>>101 beshort&0xf 0x4 \b16-FLOAT
>>>101 beshort&0xf 0x5 \b(reserved 5)
>>>101 beshort&0xf 0x6 \b32-SIGNED
>>>101 beshort&0xf 0x7 \b32-FLOAT
>>>101 beshort&0xf 0x8 \b5
>>>101 beshort&0xf 0x9 \b10
>>>101 beshort&0xf 0xa \b5-6-5
>>>101 beshort&0xf 0xb \b(reserved %d)
>>>101 beshort&0xf 0xc \b(reserved %d)
>>>101 beshort&0xf 0xd \b(reserved %d)
>>>101 beshort&0xf 0xe \b(reserved %d)
>>>101 beshort&0xf 0xf \b1-BLACK=1
>>101 beshort&0xf0 x \b, colorfmt=
>>>101 beshort&0xf0 0x00 \bYONLY
>>>101 beshort&0xf0 0x10 \bYUV240
>>>101 beshort&0xf0 0x20 \bYWV422
>>>101 beshort&0xf0 0x30 \bYWV444
>>>101 beshort&0xf0 0x40 \bCMYK
>>>101 beshort&0xf0 0x50 \bCMYKDIRECT
>>>101 beshort&0xf0 0x60 \bNCOMPONENT
>>>101 beshort&0xf0 0x70 \bRGB
>>>101 beshort&0xf0 0x80 \bRGBE
>>>101 beshort&0xf0 >0x80 \b(reserved %#x)
# JPEG XL
# From: Ian Tester
# Update: Joerg Jenderek
# URL: http://fileformats.archiveteam.org/wiki/JPEG_XL
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jxl.trid.xml
# Note: called by TrID "JPEG XL bitmap"
0 string \xff\x0a JPEG XL codestream
!:mime image/jxl
#!:mime image/jxl
!:mime image/x-jxl
!:ext jxl
# JPEG XL (transcoded JPEG file)
# Update: Joerg Jenderek
# URL: http://fileformats.archiveteam.org/wiki/JPEG_XL
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jxl-iso.trid.xml
# Note: called by TrID "JPEG XL bitmap (ISOBMFF)"
0 string \x00\x00\x00\x0cJXL\x20\x0d\x0a\x87\x0a JPEG XL container
!:mime image/jxl
#!:mime image/jxl
!:mime image/x-jxl
!:ext jxl

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: linux,v 1.80 2022/03/24 15:48:58 christos Exp $
# $File: linux,v 1.82 2022/09/07 11:23:44 christos Exp $
# linux: file(1) magic for Linux files
#
# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
@ -364,16 +364,6 @@
>24 lelong x %d symbols
>28 lelong x %d ocons
# LUKS: Linux Unified Key Setup, On-Disk Format, http://luks.endorphin.org/spec
# Anthon van der Neut (anthon@mnt.org)
0 string LUKS\xba\xbe LUKS encrypted file,
>6 beshort x ver %d
>8 string x [%s,
>40 string x %s,
>72 string x %s]
>168 string x UUID: %s
# Summary: Xen saved domain file
# Created by: Radek Vokal <rvokal@redhat.com>
0 string LinuxGuestRecord Xen saved domain
@ -535,3 +525,24 @@
>&0 regex [0-9]+\\.[0-9]+ \b, version %s
>>&0 string ;
>>>&0 regex [A-Z0-9]+ \b, encryption %s
# From: Joerg Jenderek
# URL: https://www.gnu.org/software/grub
# Reference: https://ftp.gnu.org/gnu/grub/grub-2.06.tar.gz
# grub-2.06/include/grub/keyboard_layouts.h
# grub-2.06/grub-core/commands/keylayouts.c
# GRUB_KEYBOARD_LAYOUTS_FILEMAGIC
0 string GRUBLAYO GRUB Keyboard
!:mime application/x-grub-keyboard
!:ext gkb
# GRUB_KEYBOARD_LAYOUTS_VERSION like: 10
>8 ulelong !10 \b, version %u
# 4 grub_uint32_t grub_keyboard_layout[160]
# for normal french keyboard this is letter a
>92 ubyte !0x71
>>92 ubyte >0x40 \b, english q is %c
#>732 ubyte x \b, english Q is %c
# for normal german keyboard this is letter z
>124 ubyte !0x79
>>124 ubyte >0x40 \b, english y is %c
#>764 ubyte x \b, english Y is %c

View File

@ -1,13 +1,126 @@
#------------------------------------------------------------------------------
# $File: luks,v 1.4 2009/09/19 16:28:10 christos Exp $
# $File: luks,v 1.5 2022/09/07 11:23:44 christos Exp $
# luks: file(1) magic for Linux Unified Key Setup
# URL: http://luks.endorphin.org/spec
# URL: https://en.wikipedia.org/wiki/Linux_Unified_Key_Setup
# http://fileformats.archiveteam.org/wiki/LUKS
# From: Anthon van der Neut <anthon@mnt.org>
# Update: Joerg Jenderek
# Note: verfied by command like `cryptsetup luksDump /dev/sda3`
0 string LUKS\xba\xbe LUKS encrypted file,
# https://reposcope.com/mimetype/application/x-raw-disk-image
!:mime application/x-raw-disk-image
#!:mime application/x-luks-volume
# img is the generic extension; no suffix for partitions; luksVolumeHeaderBackUp via zuluCrypt
!:ext /luks/img/luksVolumeHeaderBackUp
# version like: 1 2
>6 beshort x ver %d
# test for version 1 variant
>6 beshort 1
>>0 use luks-v1
# test for version 2 variant
>6 beshort >1
>>0 use luks-v2
# Reference: https://mirrors.edge.kernel.org/pub/linux/utils/cryptsetup/LUKS_docs/on-disk-format.pdf
# http://mark0.net/download/triddefs_xml.7z/defs/l/luks.trid.xml
# display information about LUKS version 1
0 name luks-v1
# cipher-name like: aes twofish
>8 string x [%s,
# cipher-mode like: xts-plain64 cbc-essiv
>40 string x %s,
# hash specification like: sha256 sha1 ripemd160
>72 string x %s]
>168 string x UUID: %s
# NEW PART!
# payload-offset; start offset of the bulk data
>104 ubelong x \b, at %#x data
# key-bytes; number of key bytes; key-bytes*8=MK-bits
>108 ubelong x \b, %u key bytes
# mk-digest[20]; master key checksum from PBKDF2
>112 ubequad x \b, MK digest %#16.16llx
>>120 ubequad x \b%16.16llx
>>128 ubelong x \b%8.8x
# mk-digest-salt[32]; salt parameter for master key PBKDF2
>132 ubequad x \b, MK salt %#16.16llx
>>140 ubequad x \b%16.16llx
>>148 ubequad x \b%16.16llx
>>156 ubequad x \b%16.16llx
# mk-digest-iter; iterations parameter for master key PBKDF2
>164 ubelong x \b, %u MK iterations
# key slot 1
>208 ubelong =0x00AC71F3 \b; slot #0
>>208 use luks-slot
# key slot 2
>256 ubelong =0x00AC71F3 \b; slot #1
>>256 use luks-slot
# key slot 3
>304 ubelong =0x00AC71F3 \b; slot #2
>>304 use luks-slot
# key slot 4
>352 ubelong =0x00AC71F3 \b; slot #3
>>352 use luks-slot
# key slot 5
>400 ubelong =0x00AC71F3 \b; slot #4
>>400 use luks-slot
# key slot 6
>448 ubelong =0x00AC71F3 \b; slot #5
>>448 use luks-slot
# key slot 7
>496 ubelong =0x00AC71F3 \b; slot #6
>>496 use luks-slot
# key slot 8
>544 ubelong =0x00AC71F3 \b; slot #7
>>544 use luks-slot
# Reference: https://gitlab.com/cryptsetup/LUKS2-docs/-/raw/master/luks2_doc_wip.pdf
# http://mark0.net/download/triddefs_xml.7z/defs/l/luks2.trid.xml
# display information about LUKS version 2
0 name luks-v2
# hdr_size; size including JSON area called Metadata area by cryptsetup with value like: 16384
>8 ubequad x \b, header size %llu
# possible check for MAGIC_2ND after header
#>(8.Q) string SKUL\xba\xbe \b, 2nd_HEADER_OK
# seqid; sequence ID, increased on update; called Epoch by cryptsetup with value like: 3 4 8 10
>16 ubequad x \b, ID %llu
# label[48]; optional ASCII label or empty; called Label by cryptsetup with value like: "LUKS2_EXT4_ROOT"
>24 string >\0 \b, label %s
# csum_alg[32]; checksum algorithm like: sha256 sha1 sha512 wirlpool ripemd160
>72 string x \b, algo %s
# salt[64]; salt , unique for every header
>104 ubequad x \b, salt %#llx...
# uuid[40]; UID of device as string like: 242256c6-396e-4a35-af5f-5b70cb7af9a7
>168 string x \b, UUID: %-.40s
# subsystem[48]; optional owner subsystem label or empty
>208 string >\0 \b, sub label %-.48s
# hdr_offset; offset from device start [ bytes ] like: 0
>256 ubequad !0 \b, offset %llx
# char _padding [184]; must be zeroed
#>264 ubequad x \b, padding %#16.16llx
#>440 ubequad x \b...%16.16llx
# csum[64]; header checksum
>448 ubequad x \b, crc %#llx...
# char _padding4096 [7*512]; Padding , must be zeroed
#>512 ubequad x \b, more padding %#16.16llx
#>4088 ubequad x \b...%16.16llx
# JSON text data terminated by the zero character; unused remainder empty and filled with zeroes like:
# {"keyslots":{"0":{"type":"luks2","key_size":64,"af":{"type":"luks1","stripes":4000,"hash":"sha256"},"area":{"type":"raw","offse"
>0x1000 string x \b, at 0x1000 %s
#>0x1000 indirect x
# display information (like active) about LUKS1 slot
0 name luks-slot
# state of keyslot; 0x00AC71F3~active 0x0000DEAD~inactive
#>0 ubelong x \b, status %#8.8x
>0 ubelong =0x00AC71F3 active
>0 ubelong =0x0000DEAD inactive
# iteration parameter for PBKDF2
#>4 ubelong x \b, %u iterations
# salt parameter for PBKDF2
#>8 ubequad x \b, salt %#16.16llx
#>>16 ubequad x \b%16.16llx
#>>24 ubequad x \b%16.16llx
#>>32 ubequad x \b%16.16llx
# start sector of key material like: 8 0x200 0x3f8 0x5f0 0xdd0
>40 ubelong x \b, %#x material offset
# number of anti-forensic stripes like: 4000
>44 ubelong !4000 \b, %u stripes

View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# $File: mail.news,v 1.28 2021/09/11 19:20:15 christos Exp $
# $File: mail.news,v 1.29 2022/06/17 18:02:19 christos Exp $
# mail.news: file(1) magic for mail and news
#
# Unfortunately, saved netnews also has From line added in some news software.
@ -44,8 +44,54 @@
#0 string/t Content- MIME entity text
# TNEF files...
0 lelong 0x223E9F78 Transport Neutral Encapsulation Format
# URL: http://fileformats.archiveteam.org/wiki/Transport_Neutral_Encapsulation_Format
# https://en.wikipedia.org/wiki/Transport_Neutral_Encapsulation_Format
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/t/tnef.trid.xml
# https://interoperability.blob.core.windows.net/files/MS-OXTNEF/%5bMS-OXTNEF%5d-210817.pdf
# Update: Joerg Jenderek
# Note: moved and merged from ./msdos (version 1.154) there just called "TNEF"
# partly verified by `tnef --list -v -f voice.tnef` and `ytnef -v triples.tnef`
# TNEF magic From "Joomy" <joomy@se-ed.net>
# TNEF_SIGNATURE
0 lelong 0x223E9F78 Transport Neutral Encapsulation Format (TNEF)
!:mime application/vnd.ms-tnef
# winmail.dat or win.dat by Microsoft Outlook
!:ext tnef/dat
# https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxtnef/7fdb64ee-7f63-4d95-9af1-c672e7475c3a
# LegacyKey
#>4 uleshort x \b, key %#4.4x
# attrLevelMessage; Level where attribute applies like: 1~attrLevelMessage 2~attrLevelAttachment
>6 ubyte !1 \b, 1st level %#2.2x
# other ID (like 02900000h) or TnefVersion ID (idTnefVersion=06900800h)
>7 ubelong !0x06900800 \b, 1st id %#8.8x
>7 ubelong =0x06900800
# TnefVersion lenght like: 4
>>11 ulelong !4 \b, TnefVersion length %x
# TNEFVersionData; TnefVersion data like: 00010000h
>>15 ulelong !0x00010000h \b, version %#8.8x
# Checksum like: 1
>>19 uleshort !1 \b, checksum %#4.4x
# attrLevelMessage; level of attOemCodepage like: 1
>>21 ubyte !1 \b, level %#2.2x
# idOEMCodePage; OEMCodePage ID like: 07900600h
>>22 ubelong =0x07900600 \b, OEM codepage
# OEMCodePage length like: 8
>>>26 ulelong =8
# OEMCodePageData; PrimaryCodePage like: 1251 1252
>>>>30 ulelong x %u
# OEMCodePageData; SecondaryCodePage; unused and SHOULD contain zero
>>>>34 ulelong !0 and %u
# OEMCodePageData Checksum like: E7h E8h
>>>>38 uleshort x (checksum %#x)
# attrLevelMessage of attMessageClass like: 1
>>40 ubyte !1 \b, level %u
# idMessageClass; ID of attMessageClass like: 08800700h
>>41 ubelong =0x08800700 \b, MessageAttribute
# attMessageClass length like: 16 24 25
#>>>45 ulelong x (length %u)
# attMessageClass data like: "IPM.Microsoft Mail.Note" "IPM.Note.Portada Newseum"
# "IPM.Appointment" "IPM.Note.Microsoft.Voicemail.UM.CA"
>>>45 pstring/l x "%s"
# From: Kevin Sullivan <ksulliva@psc.edu>
0 string *mbx* MBX mail folder

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: msdos,v 1.154 2022/03/21 21:25:50 christos Exp $
# $File: msdos,v 1.158 2022/09/07 11:17:31 christos Exp $
# msdos: file(1) magic for MS-DOS files
#
@ -587,7 +587,8 @@
# skip "GPG symmetrically encrypted data" ./gnu
# skip "PGP symmetric key encrypted data" ./pgp
# openpgpdefs.h: fourth byte < 14 indicate cipher algorithm type
>>>4 ubyte >13 DOS executable (COM, 0x8C-variant)
>>>4 ubyte >13
>>>>0 use msdos-com
# the remaining files should be DOS *.COM executables
# dosshell.COM 8cc0 2ea35f07 e85211 e88a11 b80058 cd
# hmload.COM 8cc8 8ec0 bbc02b 89dc 83c30f c1eb04 b4
@ -597,48 +598,164 @@
# SHARE.COM 8cca 2e8916 d602 b430 cd21 8b 2e0200 8b
# validchr.COM 8cca 2e8916 9603 b430 cd21 8b 2e028b1e
# devload.COM 8cca 8916ad01 b430 cd21 8b2e0200 892e
!:mime application/x-dosexec
!:ext com
# updated by Joerg Jenderek at Oct 2008
0 ulelong 0xffff10eb DR-DOS executable (COM)
# byte 0xeb conflicts with "sequent" magic leshort 0xn2eb
0 ubeshort&0xeb8d >0xeb00
# DR-DOS STACKER.COM SCREATE.SYS missed
0 name msdos-com
>0 byte x DOS executable (COM)
!:mime application/x-dosexec
!:ext com
# URL: http://fileformats.archiveteam.org/wiki/DOS_executable_(.com)
>0 byte x DOS executable (
# DOS execuable with JuMP 16-bit instruction
>0 byte =0xE9
# check for probably nil padding til offset 64 of Lotus driver name
>>56 quad =0
# check for "long" alpabetical Lotus driver name like:
# Diablo "COMPAQ Text Display" "IBM Monochrome Display" "Plantronics ColorPlus"
>>>24 regex =^[A-Z][A-Za-z\040]{5,21} \bLotus driver) %s
!:mime application/x-dosexec
# like: CPQ0TD.DRV IBM0MONO.DRV (Lotus 123 10a) SDIAB4.DRV SPL0CPLS.DRV (Lotus Symphony 2)
!:ext drv
# COM with nils like MODE.COM IBMDOS.COM (pcdos 3.31 ru Compaq) RSSTUB.COM (PC-DOS 2000 de) ACCESS.COM (Lotus Symphony 1)
>>>24 default x \bCOM)
!:mime application/x-dosexec
!:ext com
# DOS excutable with JuMP 16-bit and without nil padding
>>56 quad !0
# https://wiki.syslinux.org/wiki/index.php?title=Doc/comboot
# TODO: HOWTO distinguish COMboot from pure DOS executables?
# look for unreliable Syslinux specific api call INTerrupt 22h for 16-bit COMBOOT program
>>>1 search/0xc088 \xcd\x22 \bCOM or COMBOOT 16-bit)
!:mime application/x-dosexec
# like: sbm.cbt command.com (Windows XP) UNI2ASCI.COM (FreeDOS 1.2)
!:ext com/cbt
>>>1 default x \bCOM)
!:mime application/x-dosexec
!:ext com
# DOS executable without JuMP 16-bit instruction
>0 byte !0xE9
# SCREATE.SYS https://en.wikipedia.org/wiki/Stac_Electronics
>>10 string =?STACVOL \bSCREATE.SYS)
!:mime application/x-dosexec
!:ext sys
# COM executable without JuMP 16-bit instruction and not SCREATE.SYS
>>10 string !?STACVOL \bCOM)
!:mime application/x-dosexec
!:ext com
>6 string SFX\ of\ LHarc \b, %s
>0x1FE leshort 0xAA55 \b, boot code
>85 string UPX \b, UPX compressed
>4 string \ $ARX \b, ARX self-extracting archive
>4 string \ $LHarc \b, LHarc self-extracting archive
>0x20e string SFX\ by\ LARC \b, LARC self-extracting archive
# like: E30ODI.COM MADGEODI.COM UNI2ASCI.COM RECOVER.COM (DOS 2) COMMAND.COM (DOS 2)
>1 search/0xc088 \xcd\x22 \b, maybe with interrupt 22h
>0 ubelong x \b, start instruction %#8.8x
# show more instructions but not in samples like: rem.com (DJGPP)
>4 ubelong x %8.8x
# JMP 8bit
0 byte 0xeb
# byte 0xeb conflicts with magic leshort 0xn2eb of "SYMMETRY i386" handled by ./sequent
# allow forward jumps only
>1 byte >-1
# that offset must be accessible
# with hexadecimal values like: 0e 2e 50 8c 8d ba bc bd be e8 fb fc
>>(1.b+2) byte x
>>>0 use msdos-com
# if look like COM executable with x86 boot signature then this
# implies FAT volume with x86 real mode code already handled by ./filesystems
#
# No x86 boot signature implies often DOS executable
# check for unrealistic high number of FATs. Then it is an unusual disk image or often a DOS executable
# like: FIXBIOS.COM (50 bytes)
>>>16 ubyte >3
# https://www.drivedroid.io/
# skip MBR disk image drivedroid.img version 12 July 2013 by start message
>>>>2 string !DriveDroid
# ftp://old-dos.ru/OSCollect/OS/MS-DOS/Final Releases/
# skip unusual floppy image disk1.img of MS-DOS 1.25 (Corona Data Systems OEM)
# by check for characteristic message text near the beginning
>>>>>15 string !Non\040System\040disk
# "ftp://old-dos.ru/OSCollect/OS/BeOS/BeOS 4.0.rar"
# skip BeOS 4 bootfloppy.img done as "Linux kernel x86 boot executable" by ./linux
# by check for characteristic message text near the beginning
>>>>>>6 string !read\040error\015
# https://github.com/ventoy/Ventoy/releases/download/v1.0.78/ventoy-1.0.78-windows.zip
# skip ventoy 1.0.78 boot_hybrid.img
>>>>>>>24 string !\220\220\353I$\022\017
# "ftp://old-dos.ru/OSCollect/OS/MS-DOS/Final Releases/PC-DOS 1.0 (5.25).rar"
# skip unusual floppy image PCDOS100.IMG of DOS 1.0
# by check for characteristic message text near the beginning
>>>>>>>>9 string !7-May-81
# "ftp://old-dos.ru/OSCollect/OS/BeOS/BeOS 5.0 Personal (BA).rar"
# skip BeOS 5 floppy_1.44.00.ima done as "DOS/MBR boot sector" by ./filesystems
# by check for characteristic message near the beginning
>>>>>>>>>3 string !\370sdfS\270
# like: FIXBIOS.COM (50 bytes)
>>>>>>>>>>0 use msdos-com
# check for unrealistic low number of FATs. Then it is an unusual FAT disk image or often a DOS executable
# like: DEVICE.COM INSTALL.COM (GAG 4.10) WORD.COM (Word 1.15)
>>>16 ubyte =0
# if low FATs with x86 boot signature it can be unusual disk image like: boot.img (Ventoy 1.0.27) geodspms.img (Syslinux)
>>>>0x1FE leshort =0xAA55
>>>>0x1FE default x
# https://thestarman.pcministry.com/tool/hxd/dimtut.htm
# skip unusual floppy image TK-DOS11.img IBMDOS11.img of IBM DOS 1.10
# by check for characteristic bootloader names near end of boot sector
>>>>>395 string !ibmbio\040\040com
>>>>>>0 use msdos-com
# 8-bit jump with valid number of FAT implies FAT volume already handled by ./filesystems
# like: balder.img
>>>16 default x
# skip disk images with boot signature at end of 1st sector
# like: TDSK-64b.img
>>>>(11.s-2) uleshort !0xAA55
# skip unusual floppy image without boot signature like 360k-256.img (mtools 4.0.18)
# by check for characteristic file system type text for FAT (12 bit or 16 bit)
>>>>>54 string !FAT
# "ftp://old-dos.ru/OSCollect/OS/MS-DOS/Final Releases/Microsoft MS-DOS 3.31 (Compaq OEM) (3.5).rar"
# skip unusual floppy image Disk4.img without boot signature and file system type text
# by check for characteristic OEM-ID text
>>>>>>3 string !COMPAQ\040\040
# no such DOS COM executables found
>>>>>>>0 use msdos-com
# JMP 16bit
0 byte 0xe9
# 16-bit offset; for DEBUGGING!; can be negative like: USBDRIVE.COM
#>1 leshort x \b, OFFSET %d
# forward jumps
>1 short >-1
>1 leshort >-1
# that offset must be accessible
# with hexadecimal values like: 06 1e 0e 2e 60 8c 8d b4 ba be e8 fc
>>(1.s+3) byte x
>>>0 use msdos-com
# check for unrealistic high number of FATs. Then it is not a disk image and it is a DOS executable
# like: CALLVER.COM CPUCACHE.COM K437_EUR.COM SHSUCDX.COM UMBFILL.COM (183 bytes)
>>>16 ubyte >3
>>>>0 use msdos-com
# check for unrealistic low number of FATs. Then it is not a disk image and it is a DOS executable
# like: GAG.COM DRMOUSE.COM NDN.COM CPQ0TD.DRV
>>>16 ubyte =0
>>>>0 use msdos-com
# maybe disc image with valid number of FATs or DOS executable
# like: IPXODI.COM PERUSE.COM TASKID.COM
>>>16 default x
# invalid low media descriptor. Then it is not a disk image and it is a DOS executable
>>>>21 ubyte <0xE5
>>>>>0 use msdos-com
# valid media descriptor. Then it is maybe disk image or DOS executable
>>>>21 ubyte >0xE4
# invalid sectorsize not a power of 2 from 32-32768. Then it is not a disk image and it must be DOS executable
# like: LEARN.COM (Word 1.15)
>>>>>11 uleshort&0x001f !0
>>>>>>0 use msdos-com
# negative offset, must not lead into PSP
>1 short <-259
# like: BASICA.COM (PC dos 3.20) FORMAT.COM SMC8100.COM WORD.COM (word4)
# HIDSUPT1.COM USBDRIVE.COM USBSUPT1.COM USBUHCI.COM (FreeDOS USBDOS)
>1 leshort <-259
# that offset must be accessible
# add 10000h to jump at end of 64 KiB segment, add 1 for jump instruction and 2 for 16-bit offset
>>(1,s+65539) byte x
# after jump next instruction for DEBUGGING!
#>>>&-1 ubelong x \b, NEXT instruction %#8.8x
>>>0 use msdos-com
# updated by Joerg Jenderek at Oct 2008,2015
# updated by Joerg Jenderek at Oct 2008,2015,2022
# following line is too general
0 ubyte 0xb8
# skip 2 linux kernels like memtest.bin with "\xb8\xc0\x07\x8e" in ./linux
@ -661,19 +778,49 @@
# syslinux version (4.x)
# "COM executable (COM32R)" or "Syslinux COM32 module" by TrID
>>>1 lelong 0x21CD4CFe \b, relocatable)
# Hajin Jang <hajin_jang@worksmobile.com>:
# Disable simplest COM signature to prevent false positive on some EUC-KR text files.
## remaining are DOS COM executables starting with assembler instruction MOV
## like FreeDOS BANNER*.COM FINDDISK.COM GIF2RAW.COM WINCHK.COM
## MS-DOS SYS.COM RESTART.COM
## SYSLINUX.COM (version 1.40 - 2.13)
## GFXBOOT.COM (version 3.75)
## COPYBS.COM POWEROFF.COM INT18.COM
>>1 default x COM executable for DOS
!:mime application/x-dosexec
##!:mime application/x-ms-dos-executable
##!:mime application/x-msdos-program
!:ext com
>>1 default x
# look for interrupt instruction like in rem.com (DJGPP) LOADER.COM (DR-DOS 7.x)
>>>3 search/118 \xCD
# FOR DEBUGGING; possible hexadecimal interupt number like: 10~BANNER.COM 13~bcdw_cl.com 15~poweroff.com (Syslinux)
# 1A~BERNDPCI.COM 20~SETENHKB.COM 21~mostly 22~gfxboot.com (Syslinux) 2F~SHUTDOWN.COM (GEMSYS)
#>>>>&0 ubyte x \b, INTERUPT %#x
# few examples with interrupt 0x13 instruction
>>>>&0 ubyte =0x13
# FOR DEBUGGING!
#>>>>>3 ubequad x \b, 2nd INSTRUCTION %#16.16llx
# skip Gpt.com Mbr.com (edk2-UDK2018 bootsector) described as "DOS/MBR boot sector" by ./filesystems
# by check for assembler instructions: mov es,ax ; mov ax,07c0h ; mov ds,ax
>>>>>3 ubequad !0x8ec0b8c0078ed88d
# few COM exectables with interrupt 0x13 instruction like: Bootable CD Wizard executables bcdw_cl.com fdemuoff.com
# http://bootcd.narod.ru/bcdw150z_en.zip
>>>>>>0 use msdos-com
# few examples with interrupt 0x16 instruction like flashimg.img
>>>>&0 ubyte =0x16
# skip Syslinux 3.71 flashimg.img done as "DOS/MBR boot sector" by ./filesystems
# by check for assembler instructions: cmp ax 0xE4E4 (magic); jnz
>>>>>8 ubelong !0x3DE4E475
# no DOS executable with interrupt 0x16 found
>>>>>>0 use msdos-com
# most examples with interrupt instruction unequal 0x13 and 0x16
>>>>&0 default x
#>>>>>&-1 ubyte x \b, INTERUPT %#x
# like: LOADER.COM SETENHKB.COM banner.com copybs.com gif2raw.com poweroff.com rem.com
>>>>>0 use msdos-com
# few COM executables without interupt instruction like RESTART.COM (DOS 7.10) REBOOT.COM
# or some EUC-KR text files or one Ulead Imaginfo thumbnail
>>>3 default x
# FOR DEBUGGING; 2nd instruction like 0x50 (RESTART.COM) 0x8e (REBOOT.COM)
# or random like: 0x0 (IMAGINFO.PE3 sky_snow) 0xb1 (euckr_.txt)
#>>>>3 ubyte x \b, 2nd INSTRUCTION %#x
# skip 1 Ulead Imaginfo thumbnail (IMAGINFO.PE3 sky_snow)
# inside SAMPLES/TEXTURES/SKY_SNOW
# from https://archive.org/download/PI3CANON/PI3CANON.iso
>>>>3 ubyte !0x0
# skip some EUC-KR text files like: euckr_falsepositive.txt
# https://bugs.astron.com/view.php?id=186
>>>>>3 ubyte !0xb1
# like: RESTART.COM (DOS 7.10) REBOOT.COM
>>>>>>0 use msdos-com
# URL: https://en.wikipedia.org/wiki/UPX
# Reference: https://github.com/upx/upx/archive/v3.96.zip/upx-3.96/
@ -1275,11 +1422,6 @@
>>>20 long >0 TIFF starts at byte %d
>>>>24 long >0 length %d
# TNEF magic From "Joomy" <joomy@se-ed.net>
# Microsoft Outlook's Transport Neutral Encapsulation Format (TNEF)
0 lelong 0x223e9f78 TNEF
!:mime application/vnd.ms-tnef
# Norton Guide (.NG , .HLP) files added by Joerg Jenderek from source NG2HTML.C
# of http://www.davep.org/norton-guides/ng2h-105.tgz
# https://en.wikipedia.org/wiki/Norton_Guides
@ -1477,6 +1619,13 @@
>>>>>>(16.l+16) string !Panoram 7 or 8
!:ext themepack/deskthemepack
>>>>>>(16.l+16) ubyte x Theme Pack
# URL: https://en.wikipedia.org/wiki/Microsoft_OneNote#File_format
# http://fileformats.archiveteam.org/wiki/OneNote
# Reference: https://mark0.net/download/triddefs_xml.7z/defs/o/onepkg.trid.xml
# 1st member name like: "Class Notes.one" "test-onenote.one" "Open Notebook.onetoc2" "Editor Öffnen.onetoc2"
>>>>>&0 string/c one \b, OneNote Package
!:mime application/msonenote
!:ext onepkg
>>>>>&0 default x
# look for null terminator of 1st member name
>>>>>>&0 search/255 \0

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: msooxml,v 1.17 2021/11/08 13:53:43 christos Exp $
# $File: msooxml,v 1.18 2022/08/16 11:16:39 christos Exp $
# msooxml: file(1) magic for Microsoft Office XML
# From: Ralf Brown <ralf.brown@gmail.com>
@ -15,10 +15,13 @@
0 name msooxml
>0 string word/ Microsoft Word 2007+
!:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
!:ext docx
>0 string ppt/ Microsoft PowerPoint 2007+
!:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
!:ext pptx
>0 string xl/ Microsoft Excel 2007+
!:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
!:ext xlsx
>0 string visio/ Microsoft Visio 2013+
!:mime application/vnd.ms-visio.drawing.main+xml
>0 string AppManifest.xaml Microsoft Silverlight Application

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: ole2compounddocs,v 1.18 2022/05/31 17:38:36 christos Exp $
# $File: ole2compounddocs,v 1.19 2022/09/11 20:52:40 christos Exp $
# Microsoft OLE 2 Compound Documents : file(1) magic for Microsoft Structured
# storage (https://en.wikipedia.org/wiki/Compound_File_Binary_Format)
# Additional tests for OLE 2 Compound Documents should be under this recipe.
@ -236,6 +236,18 @@
!:mime application/x-corel-gal
!:ext gal
#
# From: Joerg Jenderek
# URL: https://archive.org/details/iPhoto-Plus-4
# https://filext.com/file-extension/TPL
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/t/tpl-ulead.trid.xml
# Note: found in Template sub directory in program directory of software iPhoto Plus version 4
# second, third and fourth directory entry name like TplHeader TplMainImage TplPreview
>>>>128 lestring16 TplHeader : Ulead iPhoto Template
#!:mime application/x-ole-storage
!:mime image/x-ulead-tpl
# https://www.file-extensions.org/tpl-file-extension-ulead-photo-express-template
!:ext tpl
#
# URL: https://en.wikipedia.org/wiki/Hangul_(word_processor)
# Note: "HWP Document File" signature found in FileHeader
# Second directory entry name FileHeader hint for Thinkfree Office document

View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# $File: pascal,v 1.3 2020/06/07 18:10:26 christos Exp $
# $File: pascal,v 1.4 2022/07/30 16:53:06 christos Exp $
# pascal: file(1) magic for Pascal source
#
0 search/8192 (input, Pascal source text
@ -12,3 +12,28 @@
# Free Pascal
0 string PPU Pascal unit
>3 string x \b, version %s
# From: Joerg Jenderek
# URL: https://en.wikipedia.org/wiki/Dan_Bricklin
0 string/b Type
# URL: https://dl.winworldpc.com/Dan%20Bricklins%20Demo%20II%20Version%202%20Manual.7z
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/d/dbd-v2.trid.xml
>4 string D2 Dan Bricklin's Demo 2 demo
#!:mime application/octet-stream
!:ext dbd
# URL: https://muhaz.org/turbo-pascal-download-details.html
# From: Joerg Jenderek
# Note: used by Turbo Pascal 5.5 TOUR.EXE
>4 string T2 Turbo Pascal TOUR data
#!:mime application/octet-stream
!:mime application/x-borland-cbt
!:ext cbt
# WHAT iS THAT?
#>4 string \040P Dan Bricklin's Demo 2 foo
#!:mime application/octet-stream
# _PPRINT.SG2 _PASCII.SG2
#!:ext sg2
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/d/dbd-gen.trid.xml
>4 default x Dan Bricklin's Demo demo (generic)
#!:mime application/octet-stream
!:ext dbd

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: python,v 1.44 2021/10/20 11:15:35 christos Exp $
# $File: python,v 1.45 2022/07/24 23:59:37 christos Exp $
# python: file(1) magic for python
#
# Outlook puts """ too for urgent messages
@ -86,6 +86,8 @@
!:mime application/x-bytecode.python
0 belong 0x04f30d0a python 2.7 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x0af30d0a PyPy2.7 byte-compiled
!:mime application/x-bytecode.python
0 belong 0xb80b0d0a python 3.0 byte-compiled
!:mime application/x-bytecode.python
0 belong 0xc20b0d0a python 3.0 byte-compiled
@ -186,80 +188,46 @@
!:mime application/x-bytecode.python
0 belong 0x3f0d0d0a python 3.7 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x400d0d0a python 3.7 byte-compiled
# magic 3392+ implements PEP 552: Deterministic pycs
0 name pyc-pep552
# the flag field determines how .pyc validity is checked
>4 ulelong&1 0 timestamp-based,
>>8 uledate x .py timestamp: %s UTC,
>>12 ulelong x .py size: %d bytes
>4 ulelong&1 !0 hash-based, check-source flag
>>4 ulelong&2 0 unset,
>>4 ulelong&2 !0 set,
>>8 ulequad x hash: 0x%llx
# uleshort magic followed by \x0d\0xa
2 string \x0d\x0a
# extra check: only two bits of flag field are currently used
>4 ulelong <0x4
# \x0d as part of magic should suffice till Python 3.14 (magic 3600)
>>1 ubyte 0x0d Byte-compiled Python module for
!:mime application/x-bytecode.python
0 belong 0x410d0d0a python 3.7 byte-compiled
# now look at the magic number to determine the version
>>>0 uleshort <3400 CPython 3.7,
>>>0 default x
>>>>0 uleshort <3420 CPython 3.8,
>>>>0 default x
>>>>>0 uleshort <3430 CPython 3.9,
>>>>>0 default x
>>>>>>0 uleshort <3450 CPython 3.10,
>>>>>>0 default x
>>>>>>>0 uleshort <3500 CPython 3.11,
>>>>>>>0 default x CPython 3.12 or newer,
>>>0 use pyc-pep552
>>0 uleshort 240 Byte-compiled Python module for PyPy3.7,
!:mime application/x-bytecode.python
0 belong 0x420d0d0a python 3.7 byte-compiled
>>>0 use pyc-pep552
>>0 uleshort 256 Byte-compiled Python module for PyPy3.8,
!:mime application/x-bytecode.python
0 belong 0x480d0d0a python 3.8 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x490d0d0a python 3.8 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x520d0d0a python 3.8 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x530d0d0a python 3.8 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x540d0d0a python 3.8 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x550d0d0a python 3.8 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x5c0d0d0a python 3.9 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x5d0d0d0a python 3.9 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x5e0d0d0a python 3.9 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x5f0d0d0a python 3.9 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x600d0d0a python 3.9 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x610d0d0a python 3.9 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x660d0d0a python 3.10 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x670d0d0a python 3.10 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x680d0d0a python 3.10 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x690d0d0a python 3.10 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x6a0d0d0a python 3.10 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x6b0d0d0a python 3.10 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x6c0d0d0a python 3.10 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x6d0d0d0a python 3.10 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x6e0d0d0a python 3.10 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x6f0d0d0a python 3.10 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x7a0d0d0a python 3.11 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x7b0d0d0a python 3.11 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x7c0d0d0a python 3.11 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x7d0d0d0a python 3.11 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x7e0d0d0a python 3.11 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x7f0d0d0a python 3.11 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x800d0d0a python 3.11 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x810d0d0a python 3.11 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x820d0d0a python 3.11 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x830d0d0a python 3.11 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x840d0d0a python 3.11 byte-compiled
!:mime application/x-bytecode.python
0 belong 0x850d0d0a python 3.11 byte-compiled
>>>0 use pyc-pep552
>>0 uleshort 336 Byte-compiled Python module for PyPy3.9,
!:mime application/x-bytecode.python
>>>0 use pyc-pep552
0 search/1/w #!\040/usr/bin/python Python script text executable
!:strength + 15

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: riff,v 1.44 2022/05/14 19:42:47 christos Exp $
# $File: riff,v 1.45 2022/07/24 23:47:49 christos Exp $
# riff: file(1) magic for RIFF format
# See
#
@ -333,6 +333,27 @@
#>>>0 use corel-des
#>>>0 use corel-draw
>8 string NUNDROOT \b, Steinberg CuBase
# From: Joerg Jenderek
# URL: http://fileformats.archiveteam.org/wiki/MIDI_Instrument_Definition_File
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/i/idf.trid.xml
# ftp://curscott.servebeer.com/Download/Apps/_Microsoft/
# Visual%20Studio%206.0%20Professional%20MSDN/
# SAMPLES/VC98/SDK/GRAPHICS/AUDIO/IDFEDIT/GLOBALS.H
# Note: called "MIDI Instrument Definition File" by TrID
>8 string IDF\ LIST \b, MIDI Instrument Definition File
!:mime audio/x-idf
!:ext idf
# 3rd chunk size like: 254 284 286 670
#>>0x10 ulelong x \b, 3th SIZE %u
# for debugging purpose display next chunk like: MMAPhdr
#>>0x14 string x \b, 4th "%-8.8s"
#>>0x1C ulelong x \b, 4th SIZE 0x%x
# probably MIDI instrument name like: "Universal-MIDI-Instrument" "instrument name" "General MIDI"
>>0x30 string x "%s"
# look for inst TAG
>>0x31 search/256 inst by
# probably manufacture name like: "Unspecified Company" "NVidia Corporation"
>>>&0x24 string x "%s"
# AVI == Audio Video Interleave
# Reference: http://fileformats.archiveteam.org/wiki/AVI
>8 string AVI\040 \b, AVI

View File

@ -0,0 +1,45 @@
#------------------------------------------------------------------------------
# $File: ringdove,v 1.1 2022/08/16 12:04:30 christos Exp $
# ringdove: file(1) magic for RingdoveEDA data files
# librnd and global
0 regex/128l ha:rnd-menu-v[0-9]+[\ \t\r\n]*[{] librnd menu system (lihata)
0 regex/128l ha:rnd-menu-patch-v[0-9]+[\ \t\r\n]*[{] librnd menu patch (lihata)
0 regex/128l ha:coraleda-project-v[0-9]+[\ \t\r\n]*[{] CoralEDA/Ringdove project file (lihata)
0 regex/128l ha:ringdove-project-v[0-9]+[\ \t\r\n]*[{] Ringdove project file (lihata)
# pcb-rnd
0 regex/128l ha:pcb-rnd-board-v[0-9]+[\ \t\r\n]*[{] pcb-rnd board file (lihata)
0 regex/128l li:pcb-rnd-subcircuit-v[0-9]+[\ \t\r\n]*[{] pcb-rnd subcircuit/footprint file (lihata)
0 regex/128l ha:pcb-rnd-buffer-v[0-9]+[\ \t\r\n]*[{] pcb-rnd paste buffer content (lihata)
0 regex/128l li:pcb-rnd-conf-v[0-9]+[\ \t\r\n]*[{] pcb-rnd configuration (lihata)
0 regex/128l ha:pcb-rnd-drc-query-v[0-9]+[\ \t\r\n]*[{] pcb-rnd drc query string (lihata)
0 regex/128l li:pcb-rnd-font-v[0-9]+[\ \t\r\n]*[{] pcb-rnd vector font (lihata)
0 regex/128l ha:pcb-rnd-log-v[0-9]+[\ \t\r\n]*[{] pcb-rnd message log dump (lihata)
0 regex/128l ha:pcb-rnd-padstack-v[0-9]+[\ \t\r\n]*[{] pcb-rnd padstack (lihata)
0 regex/128l li:pcb-rnd-view-list-v[0-9]+[\ \t\r\n]*[{] pcb-rnd view list (lihata)
0 regex/128l li:view-list-v[0-9]+[\ \t\r\n]*[{] pcb-rnd view list (lihata)
0 search Netlist(Freeze) pcb-rnd or gEDA/PCB netlist forward annotation action script
# sch-rnd (cschem data model)
0 regex/128l li:cschem-buffer-v[0-9]+[\ \t\r\n]*[{] sch-rnd/cschem buffer content (lihata)
0 regex/128l li:sch-rnd-conf-v[0-9]+[\ \t\r\n]*[{] sch-rnd configuration (lihata)
0 regex/128l ha:std_devmap.v[0-9]+[\ \t\r\n]*[{] sch-rnd devmap (device mapping; lihata)
0 regex/128l li:cschem-group-v[0-9]+[\ \t\r\n]*[{] sch-rnd/cschem group or symbol (lihata)
0 regex/128l ha:cschem-sheet-v[0-9]+[\ \t\r\n]*[{] sch-rnd/cschem schematic sheet (lihata)
# tEDAx (modular format)
0 regex/1l tEDAx[\ \t\r\n]v tEDAx (Trivial EDA eXchange)
>0 regex begin\ symbol\ v with schematic symbol
>0 regex begin\ board\ v with Printed Circuit Board
>0 regex begin\ route_req\ v with PCB routing request
>0 regex begin\ route_res\ v with PCB routing result
>0 regex begin\ camv_layer\ v with camv-rnd exported layer
>0 regex begin\ netlist\ v with netlist
>0 regex begin\ backann\ v with Ringdove EDA back annotation
>0 regex begin\ footprint\ v with PCB footprint
>0 regex begin\ drc\ v with PCB DRC script
>0 regex begin\ drc_query_rule\ v with pcb-rnd drc_query rules
>0 regex begin\ drc_query_def\ v with pcb-rnd drc_query value/config definitions
>0 regex begin\ etest\ v with PCB electric test

View File

@ -1,16 +1,18 @@
#------------------------------------------------------------------------------
# $File: sgml,v 1.45 2022/03/21 21:36:55 christos Exp $
# $File: sgml,v 1.46 2022/08/16 11:16:39 christos Exp $
# Type: SVG Vectorial Graphics
# From: Noel Torres <tecnico@ejerciciosresueltos.com>
0 string \<?xml\ version=
>14 regex ['"\ \t]*[0-9.]+['"\ \t]*
>>19 search/4096 \<svg SVG Scalable Vector Graphics image
!:mime image/svg+xml
!:ext svg
>>19 search/4096 \<gnc-v2 GnuCash file
!:mime application/x-gnucash
0 string \<svg SVG Scalable Vector Graphics image
!:mime image/svg+xml
!:ext svg
# Sitemap file
0 string/t \<?xml\ version=

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: sniffer,v 1.31 2022/03/20 22:45:43 christos Exp $
# $File: sniffer,v 1.32 2022/07/30 16:46:56 christos Exp $
# sniffer: file(1) magic for packet capture files
#
# From: guy@alum.mit.edu (Guy Harris)
@ -270,6 +270,11 @@
>20 belong&0x03FFFFFF 288 (USB 2.0
>20 belong&0x03FFFFFF 289 (ATSC ALP
>20 belong&0x03FFFFFF 290 (Event Tracing for Windows
>20 belong&0x03FFFFFF 291 (Hilscher netANALYZER NG pseudo-footer
>20 belong&0x03FFFFFF 292 (ZBOSS NCP protocol with pseudo-header
>20 belong&0x03FFFFFF 293 (Low-Speed USB 2.0/1.1/1.0
>20 belong&0x03FFFFFF 294 (Full-Speed USB 2.0/1.1/1.0
>20 belong&0x03FFFFFF 295 (High-Speed USB 2.0
# print default match
>20 default x
>>20 belong x (linktype#%u

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: sql,v 1.23 2021/07/30 14:53:38 christos Exp $
# $File: sql,v 1.24 2022/07/17 15:32:48 christos Exp $
# sql: file(1) magic for SQL files
#
# From: "Marty Leisner" <mleisner@eng.mc.xerox.com>
@ -217,3 +217,9 @@
# H2 Database from https://www.h2database.com/
0 string --\ H2\ 0.5/B\ --\ \n H2 Database file
# DuckDB database file from https://duckdb.org
8 string DUCK DuckDB database file
>12 lequad x \b, version %lld
#>20 lequad x \b, flags %#llx
#>28 lequad x \b, flags %#llx

View File

@ -0,0 +1,38 @@
#------------------------------------------------------------------------------
# $File: subtitle,v 1.2 2022/09/07 11:29:09 christos Exp $
# subtitle: file(1) magic for subtitles files
# EBU-STL
# https://tech.ebu.ch/docs/tech/tech3264.pdf
3 string STL EBU-STL subtitles
>6 regex =^[0-9][0-9] \b, rate %s
>>8 string .01 \b, v1
!:mime application/x-ebu-stl
>>>16 regex =^[^\ ]{0,32} \b, title "%s"
>>>>224 regex =^[0-9]{2} \b, created %-.2s
>>>>>&0 regex =^[0-9]{2} \b-%-.2s
>>>>>>&0 regex =^[0-9]{2} \b-%-.2s
!:ext stl
# SubRip (srt) subtitles
0 regex/20 =^1[\r\n]+0[01]:[0-9]{2}:[0-9]{2},[0-9]{3}\040--> SubRip
!:mime application/x-subrip
!:ext srt
# WebVTT subtitles
# https://www.w3.org/TR/webvtt1/
0 string/t WEBVTT
>&0 regex/255 =[0-9]{2}:[0-9]{2}\\.[0-9]{3}\040--> WebVTT subtitles
!:mime text/vtt
!:ext vtt
# XML TTML subtitles
# https://www.w3.org/TR/ttml2/
0 string/t \<?xml
>20 search/400 \020xmlns=
>>&0 regex ['"]http://www.w3.org/ns/ttml TTML subtitles
!:mime application/ttml+xml
# Augment strength to beat plain XML
!:strength * 3
!:ext ttml

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: virtual,v 1.16 2022/01/18 14:08:15 christos Exp $
# $File: virtual,v 1.17 2022/08/23 08:00:54 christos Exp $
# From: James Nobis <quel@quelrod.net>
# Microsoft hard disk images for:
# Virtual Server
@ -9,10 +9,10 @@
# URL: http://fileformats.archiveteam.org/wiki/VHD_(Virtual_Hard_Disk)
# Reference: https://download.microsoft.com/download/f/f/e/ffef50a5-07dd-4cf8-aaa3-442c0673a029/
# Virtual%20Hard%20Disk%20Format%20Spec_10_18_06.doc
0 string connectix Microsoft Disk Image, Virtual Server or Virtual PC
0 string conectix Microsoft Disk Image, Virtual Server or Virtual PC
# alternative shorter names
#0 string connectix Microsoft Virtual Hard Disk image
#0 string connectix Microsoft Virtual HD image
#0 string conectix Microsoft Virtual Hard Disk image
#0 string conectix Microsoft Virtual HD image
!:mime application/x-virtualbox-vhd
!:ext vhd
# Features is a bit field used to indicate specific feature support

View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# $File: webassembly,v 1.3 2019/04/19 00:42:27 christos Exp $
# $File: webassembly,v 1.4 2022/08/16 11:16:39 christos Exp $
# webassembly: file(1) magic for WebAssembly modules
#
# WebAssembly is a virtual architecture developed by a W3C Community
@ -12,4 +12,6 @@
0 string \0asm WebAssembly (wasm) binary module
>4 lelong =1 version %#x (MVP)
!:mime application/wasm
!:ext wasm
>4 lelong >1 version %#x

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: windows,v 1.44 2022/05/31 17:39:08 christos Exp $
# $File: windows,v 1.46 2022/07/02 17:46:09 christos Exp $
# windows: file(1) magic for Microsoft Windows
#
# This file is mainly reserved for files where programs
@ -15,14 +15,84 @@
# Summary: Outlook Express DBX file
# Extension: .dbx
# Created by: Christophe Monniez
0 string \xCF\xAD\x12\xFE MS Outlook Express DBX file
>4 byte =0xC5 \b, message database
>4 byte =0xC6 \b, folder database
>4 byte =0xC7 \b, account information
>4 byte =0x30 \b, offline database
# Update: Joerg Jenderek
# URL: http://fileformats.archiveteam.org/wiki/Outlook_Express_Database
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/d/dbx.trid.xml
# https://sourceforge.net/projects/ol2mbox/files/LibDBX/
# v1.0.4/libdbx_1.0.4.tar.gz/FILE-FORMAT
# Note: called "Outlook Express Database" by TrID and DROID via PUID fmt/838 fmt/839
# and partly verified by `undbx --verbosity 4 Posteingang.dbx`
0 string \xCF\xAD\x12\xFE
# skip DROID fmt-838-signature-id-1193.dbx fmt-839-signature-id-1194.dbx by check for valid file size
>0x7C ulelong >0 MS Outlook Express DBX file
#!:mime application/octet-stream
#!:mime application/vnd.ms-outlook
!:mime application/x-ms-dbx
!:ext dbx
>>4 byte =0xC5 \b, message database
>>4 byte =0xC6 \b, folder database
>>4 byte =0xC7 \b, account information
>>4 byte =0x30 \b, offline database
# version like: 5.2 5.5 (typical)
>>20 ulequad !0x0000000500000005 \b, version
# major version
>>>24 ulelong x %u
# minor version
>>>20 ulelong x \b.%u
# CLSID: 6F74FDC5-E366-11d1-9A4E-00C04FA309D4~Message 6F74FDC6-E366-11D1-9A4E-00C04FA309D4~Folder
# 26FE9D30-1A8F-11D2-AABF-006097D474C4~offline
#>>4 guid x \b, CLSID %s
# file size; total size of file; sometimes real size a little bit higher
>>0x7C ulelong x \b, ~ %u bytes
# highest Email ID; the next email will have a number one higher than this
>>0x5c ulelong x \b, highest ID %#x
# item count; number of items stored in this DBX file
>>0xC4 ulelong x \b, %u item
# plural s
>>0xC4 ulelong !1 \bs
# index pointer; file offset pointing to a page of Data Indexes
>>0xE4 ulelong >0 \b, index pointer %#x
# From: Joerg Jenderek
# URL: http://fileformats.archiveteam.org/wiki/Nickfile
# https://www.nirsoft.net/utils/outlook_nk2_edit.html
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/n/nk2.trid.xml
# https://github.com/libyal/libnk2/blob/main/documentation
# Nickfile%20(NK2)%20format.asciidoc
# Note: called "Outlook Nickfile" by TrID & TestDisk and
# "Outlook Nickname File" by Microsoft Outlook and
# "Outlook AutoComplete File" by Nirsoft NK2Edit
# partly verfied by NK2Edit Raw Text Edit Mode
0 ubelong 0x0DF0ADBA MS Outlook Nickfile
#!:mime application/octet-stream
#!:mime application/vnd.ms-outlook
!:mime application/x-ms-nickfile
!:ext nk2/dat/bak
# nick is used by "older" Outlook; dat is used by "newer" Outlook (probably 2010 - 2016); bak is used for backup
#!:ext nick/nk2/dat/bak
# Unknown; probably a version indicator like: 0000000Ah 0000000Ch
>4 ulelong x \b, probably version %u
# Unknown2; probably a version indicator like: 1 0
>8 ulelong x \b.%u
# number of rows (nickname or alias items) in file
>12 ulelong x \b, %u items
# number of item entries/columns/properties value like: 17h
>16 ulelong x \b, %u entries
# value type/property tag: 001Fh~4 bytes for data size of UTF-16 LE string
>20 uleshort x \b, value type %#4.4x
# entry type/property identifier: 6001h~PR_DOTSTUFF_STATE/PR_NICK_NAME_W
>22 uleshort x \b, entry type %#4.4x
# Reserved like: 0013FD90h
#>24 ulelong x \b, reserved %#8.8x
# value data array/Irrelevant Union like: 0000000004E31A80h
#>28 ulequad x \b, data %#16.16llx
# UTF-16
>20 uleshort =0x001F
# unicode string bytes like: 2Ch
>>36 ulelong x \b, %u bytes
# unicode string value PT_UNICODE like: janesmith@contoso.org
>>40 lestring16 x "%s"
# Summary: Windows crash dump
# Extension: .dmp
@ -429,9 +499,95 @@
# Summary: Outlook Personal Folders
# Created by: unknown
0 lelong 0x4E444221 Microsoft Outlook email folder
>10 leshort 0x0e (<=2002)
>10 leshort 0x17 (>=2003)
# Update: Joerg Jenderek
# URL: http://fileformats.archiveteam.org/wiki/Personal_Folder_File
# https://en.wikipedia.org/wiki/Personal_Storage_Table
# Reference: https://interoperability.blob.core.windows.net/files/MS-PST/%5bMS-PST%5d.pdf
# http://mark0.net/download/triddefs_xml.7z/defs/p/pab.trid.xml
# dwMagic !BDN
0 lelong 0x4E444221
# skip DROID x-fmt-75-signature-id-472.pab x-fmt-248-signature-id-260.pst x-fmt-249-signature-id-261.pst
# by check for existance of bPlatformCreate value
>14 ubyte x Microsoft Outlook
#!:mime application/octet-stream
# NOT official registered !
!:mime application/vnd.ms-outlook
# dwCRCPartial; 32-bit cyclic redundancy check (CRC) value of followin 471 bytes; zero for 64-bit
#>>4 ulelong !0 \b, CRC %#x
# wMagicClient; AB (4142h) is used for PAB files; SM (534Dh) is used for PST files; SO (534Fh) is used for OST files
#>>8 leshort x \b, wMagicClient=%#x
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/p/pab.trid.xml
# Note: called "Microsoft Personal Address Book" by TrID and
# "Microsoft Outlook Personal Address Book" by DROID via x-fmt/75
>>8 leshort 0x4142 Personal Address Book
#!:mime application/x-ms-pab
!:ext pab
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/p/pst.trid.xml
# http://mark0.net/download/triddefs_xml.7z/defs/p/pst-unicode.trid.xml
# Note: called "Microsoft OutLook Personal Folder" by TrID and
# by DROID via x-fmt/248 for ANSI and via x-fmt/249 for Unicode
#>>8 leshort 0x4D53 \b, PST~
# called "Microsoft Outlook email folder" in ./windows version 1.37 and older
>>8 leshort 0x4D53 Personal Storage
#!:mime application/x-ms-pst
!:ext pst
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/o/ost.trid.xml
# Note: called "Outlook Exchange Offline Storage" by TrID
>>8 leshort 0x4F53 Offline Storage
#!:mime application/x-ms-ost
!:ext ost
# wVer; file format version. 14 or 15 if the file is ANSI; > 21 or 23(=17h) if Unicode; 37 for written by Outlook with WIP
>>10 uleshort x (
# probably NO intermediate versions exist
>>10 leshort <0x10 \b<=2002, ANSI,
>>10 leshort >0x14 \b>=2003, Unicode,
>>10 uleshort x version %u)
# wVerClient; client file format version like: 19 22
#>>12 uleshort x \b, wVerClient=%u
# bPlatformCreate; This value MUST be set to 1 but also found 2
>>14 ubyte >1 \b, bPlatformCreate=%u
# bPlatformAccess; This value MUST be set to 1 but also found 2
>>15 ubyte >1 \b, bPlatformAccess=%u
# dwReserved1; SHOULD ignore and NOT modify this value; SHOULD initialize to zero
>>16 ulelong !0 \b, dwReserved1=%#x
# dwReserved2; SHOULD ignore and NOT modify this value; SHOULD initialize to zero
>>20 ulelong !0 \b, dwReserved2=%#x
# ANSI 32-bit variant Outlook 1997-2002
>>10 uleshort <16
# bidNextB; next BlockID (ANSI 4 bytes)
#>>>24 ulelong !0 \b, bidNextB=%#x
# bidNextP; Next available back BlockID pointer
#>>>28 ulelong !0 \b, bidNextP=%#x
# dwUnique; value monotonically increased when modifying PST; so CRC is changing
>>>32 ulelong !0 \b, dwUnique=%#x
# rgnid[128]; A fixed array of 32 NodeIDs, each corresponding to one of the 32 possible NID_TYPEs
#>>>36 ubequad x \b, rgnid=%#llx...
# dwReserved; Implementations SHOULD ignore this value and SHOULD NOT modify it; Initialized zero
>>>164 ulelong !0 \b, dwReserved=%#x
# ibFileEof; the size of the PST file, in bytes (ANSI 4 bytes)
>>>168 ulelong x \b, %u bytes
# ibAMapLast; offset to the last AMap page
#>>>172 ulelong x \b, ibAMapLast=%#x
# bSentinel; MUST be set to 0x80
>>>460 ubyte !0x80 \b, bSentinel=%#x
# bCryptMethod: 0~No encryption 1~encryption with permutation 2~encryption with cyclic 16~encryption with Windows Information Protection (WIP)
>>>461 ubyte >0 \b, bCryptMethod=%u
# UNICODE 64-bit variant Outlook 2003-2007
>>10 uleshort >20
# bidUnused; Unused 8 bytes padding (Unicode only); sometimes like: 0x0000000100000004
>>>24 ulequad !0x0000000100000004 \b, bidUnused=%#16.16llx
# dwUnique; value monotonically increased when modifying PST; so CRC is changing
>>>40 ulelong !0 \b, dwUnique=%#x
# rgnid[] (128 bytes): A fixed array of 32 NIDs, each corresponding to one of the 32 possible
#>>>44 ubequad x \b, rgnid=%#llx...
# ibFileEof; the size of the PST file, in bytes (Unicode 8 bytes)
>>>184 ulequad x \b, %llu bytes
# bSentinel; MUST be set to 0x80
>>>512 ubyte !0x80 \b, bSentinel=%#x
# bCryptMethod; Encryption type like: 0 1 2 16
>>>513 ubyte >0 \b, bCryptMethod=%u
# dwCRC; 32-bit CRC of the of the previous 516 bytes
>>>524 ulelong x \b, CRC32 %#x
# Summary: Windows help cache

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: wordprocessors,v 1.27 2021/12/06 15:05:16 christos Exp $
# $File: wordprocessors,v 1.31 2022/08/31 08:00:53 christos Exp $
# wordprocessors: file(1) magic fo word processors.
#
####### PWP file format used on Smith Corona Personal Word Processors:
@ -28,35 +28,170 @@
!:ext wps
# Corel/WordPerfect
# URL: https://en.wikipedia.org/wiki/WordPerfect
# Reference: https://github.com/OneWingedShark/WordPerfect/blob/master/doc/SDK_Help/FileFormats/WPFF_DocumentStructure.htm
# http://mark0.net/download/triddefs_xml.7z/defs/w/wp-generic.trid.xml
0 string \xffWPC
# WordPerfect
>8 byte 1
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/w/wpm-macro.trid.xml
# Note: there exist other macro variants
>>9 byte 1 WordPerfect macro
#!:mime application/octet-stream
!:mime application/x-wordperfect-wpm
# like: ALTD.WPM ENDFOOT.WPM FOOTEND.WPM LABELS.WPM REVEALTX.WPM
!:ext wpm
# Note: used in WordPerfect 5.1; there exist other FIL variants
>>9 byte 2 WordPerfect help file
#!:mime application/octet-stream
!:mime application/x-wordperfect-help
# like: WPHELP.FIL
!:ext fil
# pointer to document area like: 10h
>>>4 ulelong !0x10 \b, at %#x document area
>>9 byte 3 WordPerfect keyboard file
#!:mime application/octet-stream
!:mime application/x-wordperfect-keyboard
!:ext wpk
# no document area, so point to end of file; so this is file size like: 23381 2978 32835 3355 3775 919
>>>4 ulelong x \b, %u bytes
>>9 byte 4 WordPerfect VAX keyboard definition
#!:mime application/octet-stream
!:mime application/x-wordperfect-keyboard
#!:ext foo
# URL: http://fileformats.archiveteam.org/wiki/WordPerfect
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/w/wpd-doc-gen.trid.xml
>>9 byte 10 WordPerfect document
# https://www.iana.org/assignments/media-types/application/vnd.wordperfect
!:mime application/vnd.wordperfect
#!:apple ????WPC2
# TODO: distinguish different suffix
!:ext wpd/wpt/wkb/icr/tut/sty/tst/crs
>>9 byte 11 WordPerfect dictionary
>>9 byte 12 WordPerfect thesaurus
>>9 byte 13 WordPerfect block
>>9 byte 14 WordPerfect rectangular block
>>9 byte 15 WordPerfect column block
>>9 byte 16 WordPerfect printer data
#!:mime application/octet-stream
!:mime application/x-wordperfect-prs
# like: STANDARD.PRS WORKBOOK.PRS
!:ext prs
# like: "Standard Printer" "Workbook Printer"
>>>0x64 pstring/B >A "%s"
#>>9 byte 18 WordPerfect Prefix information file
# printer resource .ALL
>>9 byte 19 WordPerfect printer data
#!:mime application/octet-stream
!:mime application/x-wordperfect-all
!:ext all
# display Resource
>>9 byte 20 WordPerfect driver resource data
#!:mime application/octet-stream
!:mime application/x-wordperfect-drs
# like: WPSMALL.DRS
!:ext drs
# pointer to index area with string "smalldrs" like: 46h
>>>4 uleshort !0x46 \b, at %#x index area
>>9 byte 21 WordPerfect Overlay file
#!:mime application/octet-stream
!:mime application/x-wordperfect-fil
# like: WP.FIL
!:ext fil
# URL: http://fileformats.archiveteam.org/wiki/WordPerfect_Graphics
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-wpg.trid.xml
# Note: called "WordPerfect Graphics bitmap" by TrID and
# "WordPerfect Graphics Metafile" by DROID via x-fmt/395 fmt/1042
# "WPG (Word Perfect Graphics)" by ImageMagick `identify -verbose BUTTRFLY.WPG`
>>9 byte 22 WordPerfect graphic image
# TODO: skip DROID x-fmt-395-signature-id-132.wpg by check for existing document area
#>>>4 ulelong >15 WordPerfect_graphic_OK
#!:mime application/octet-stream
# http://extension.nirsoft.net/wpg
!:mime image/x-wordperfect-graphics
# https://reposcope.com/mimetype/application/x-wpg
#!:mime application/x-wpg
# like: BUTTRFLY.WPG STAR-5.WPG input.wpg WORDPFCT.WPG
!:ext wpg
# pointer to document area like: 10h 1Ah
>>>4 ulelong !0x1A \b, at %#x document area
>>9 byte 23 WordPerfect hyphenation code
>>9 byte 24 WordPerfect hyphenation data
>>9 byte 25 WordPerfect macro resource data
#!:mime application/octet-stream
!:mime application/x-wordperfect-mrs
# like: WP.MRS
!:ext mrs
>>9 byte 27 WordPerfect hyphenation lex
>>9 byte 29 WordPerfect wordlist
>>9 byte 30 WordPerfect equation resource data
#!:mime application/octet-stream
!:mime application/x-wordperfect-qrs
# like: WQ.QRS wpDE.qrs wpen.qrs
!:ext qrs
# jump to document area with some marker and equation
>>>(4.l) ubyte x
# equation like: "Fraction: x OVER y"
>>>>&1 string >A (...%-.19s...)
# pointer to document area like: 17C4h
>>>4 ulelong x \b, at %#x document area
#>>9 byte 31 reserved
#>>9 byte 32 WordPerfect VAX .SET
>>9 byte 33 WordPerfect spell rules
>>9 byte 34 WordPerfect dictionary rules
#>>9 byte 35 reserved
# video resource device driver
# Note: filetype 26 for VRS and filetype 36 for WPD apparently is wrong
>>9 byte 36 WordPerfect Video Resource
#!:mime application/octet-stream
!:mime application/x-wordperfect-vrs
# like: STANDARD.VRS
!:ext vrs
# like: "IBM CGA (& compatibles)"
>>>0x20 string >A "%.23s"
>>9 byte 39 WordPerfect spell rules (Microlytics)
#>>9 byte 40 reserved
>>9 byte 41 WordPerfect Install options
#!:mime application/octet-stream
!:mime application/x-wordperfect-ins
# like: WP51.INS
!:ext ins
# probably default directory name like: "C:\WP51\"
>>>0x12 string >A "%.8s"
# maybe mouse driver for WP5.1
>>9 byte 42 WordPerfect Resource
#!:mime application/octet-stream
!:mime application/x-wordperfect-irs
# like: STANDARD.IRS
!:ext irs
# like: "Mouse Driver (MOUSE.COM)"
>>>0x28 string >A "%.24s"
>>9 byte 43 WordPerfect settings file
# maybe Macintosh WP2.0 document
>>9 byte 44 WordPerfect 3.5 document
!:mime application/vnd.wordperfect
!:apple ????WPD3
# like: WP3.wpd
!:ext wpd
>>9 byte 45 WordPerfect 4.2 document
# External spell code module (WP5.1)
#>>9 byte 46 WordPerfect external spell
# external spell dictionary .LEX
#>>9 byte 47 WordPerfect external spell dictionary
# Macintosh SOFT graphics file (SOFT (Sequential Object Format)
#>>9 byte 48 WordPerfect SOFT graphics
#>>9 byte 49 reserved
#>>9 byte 50 reserved
# WPWin 5.1 Application Resource Library added for WPWin 5.1
#>>9 byte 51 WordPerfect application resource library
>>9 byte 69 WordPerfect dialog file
# From: Joerg Jenderek
# Note: found in sub directory WritingTools inside WordPerfect 2021 program directory
>>9 byte 70 WordPerfect Writing Tools
#!:mime application/octet-stream
!:mime application/x-wordperfect-cbt
# like: Wt13cbede.cbt Wt13cbeit.cbt Wt13cbefr.cbt WT21cbede.cbt Wt13cbeEN.CBD WT21cbeEN.CBD
!:ext cbd/cbt
>>9 byte 76 WordPerfect button bar
>>9 default x
>>>9 byte x Corel WordPerfect: Unknown filetype %d
@ -196,11 +331,48 @@
>>9 byte 24 GroupWise admin ADS deferment data file
>>9 default x
>>>9 byte x GroupWise: Unknown filetype %d
# Corel Writing Tools WT*.*
# From: Joerg Jenderek
# URL: https://support.corel.com/hc/en-us/articles/215876258-Writing-Tools-Spell-Check-Dictionary-does-not-work-in-WordPerfect-X5
# http://wordperfect.helpmax.net/en/editing-and-formatting-documents/using-the-writing-tools/working-with-user-word-lists/
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/u/uwl-wp.trid.xml
>8 byte 32
>>9 byte 10 Corel Writing Tools User Word List
#!:mime application/octet-stream
!:mime application/x-wordperfect-wordlist
# personal user word list UWL under user directory like: WTDE.UWL WTUS.UWL WT21DE.UWL WT21US.UWL WT13DE.UWL ...
# and "template" SAV/HWL variant under program directory like: wt13en.hwl Wt13de.sav Wt13it.sav wt13ru.sav WT21us.sav Wtcz.sav ...
!:ext uwl/hwl/sav
# jump to document area with some marker and word list
>>>(4.l) ubyte x
# look for beginning of word list starting mostly with letter a as UTF-16 like: Wt13es.sav
# but not found in russian wt13ru.sav
>>>>&0 search/91/sb a\0
# word list starting like: "acsesory\022accessory.\001\026acomodate\026accommodate4\001"
>>>>>&0 lestring16 x (...%-.33s...)
# pointer to document area like: 200h
>>>4 ulelong !0x200 \b, at %#x document area
# file size, not including pad characters at EOF
>>>0x14 uleshort x \b, %u bytes
# IntelliTAG
>8 byte 33
>>9 byte 10 IntelliTAG (SGML) compiled DTD
>>9 default x
>>>9 byte x IntelliTAG: Unknown filetype %d
# Summary: Corel WordPerfect WritingTools advise part
# From: Joerg Jenderek
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/a/adv-wp.trid.xml
>8 byte 34
>>9 byte 11 Corel WordPerfect dictionary advise
#!:mime application/octet-stream
!:mime application/x-wordperfect-adv
#!:mime application/vnd.wordperfect.adv
# like: WT21de.adv Wt13de.adv Wt13es.adv Wt13fr.adv wt13us.adv
!:ext adv
# advise text part often start with tag like: 580A
#>>>(16.s) ubequad x ADVISE PART %#llx
# part of advise text like: "This is too informal for most writing."
>>>(16.s+16) string x (...%-.33s...)
# everything else
>8 default x
>>8 byte x Unknown Corel/Wordperfect product %d,

View File

@ -1,6 +1,7 @@
#------------------------------------------------------------------------------
# $File: xo65,v 1.4 2009/09/19 16:28:13 christos Exp $
# $File: xo65,v 1.5 2022/07/17 15:36:20 christos Exp $
# https://cc65.github.io/doc/sim65.html
# xo65 object files
# From: "Ullrich von Bassewitz" <uz@cc65.org>
#
@ -28,3 +29,9 @@
>6 leshort&0x0003 =0x0001 alignment 2
>6 leshort&0x0003 =0x0002 alignment 4
>6 leshort&0x0003 =0x0003 alignment 256
# sim65 executable files
0 string \x73\x69\x6d\x36\x35 sim65 executable,
>5 byte x version %d,
>6 leshort&0x0000 =0x0000 6502
>6 leshort&0x0001 =0x0001 65C02

View File

@ -1,5 +1,5 @@
#
# $File: Makefile.am,v 1.178 2022/04/02 14:47:42 christos Exp $
# $File: Makefile.am,v 1.182 2022/09/11 21:04:30 christos Exp $
#
MAGIC_FRAGMENT_BASE = Magdir
MAGIC_DIR = $(top_srcdir)/magic
@ -53,6 +53,7 @@ $(MAGIC_FRAGMENT_DIR)/bout \
$(MAGIC_FRAGMENT_DIR)/bsdi \
$(MAGIC_FRAGMENT_DIR)/bsi \
$(MAGIC_FRAGMENT_DIR)/btsnoop \
$(MAGIC_FRAGMENT_DIR)/burp \
$(MAGIC_FRAGMENT_DIR)/bytecode \
$(MAGIC_FRAGMENT_DIR)/c-lang \
$(MAGIC_FRAGMENT_DIR)/c64 \
@ -119,6 +120,7 @@ $(MAGIC_FRAGMENT_DIR)/fusecompress \
$(MAGIC_FRAGMENT_DIR)/games \
$(MAGIC_FRAGMENT_DIR)/gcc \
$(MAGIC_FRAGMENT_DIR)/gconv \
$(MAGIC_FRAGMENT_DIR)/gentoo \
$(MAGIC_FRAGMENT_DIR)/geo \
$(MAGIC_FRAGMENT_DIR)/geos \
$(MAGIC_FRAGMENT_DIR)/gimp \
@ -257,6 +259,7 @@ $(MAGIC_FRAGMENT_DIR)/pyramid \
$(MAGIC_FRAGMENT_DIR)/python \
$(MAGIC_FRAGMENT_DIR)/qt \
$(MAGIC_FRAGMENT_DIR)/revision \
$(MAGIC_FRAGMENT_DIR)/ringdove \
$(MAGIC_FRAGMENT_DIR)/riff \
$(MAGIC_FRAGMENT_DIR)/rpi \
$(MAGIC_FRAGMENT_DIR)/rpm \
@ -289,6 +292,7 @@ $(MAGIC_FRAGMENT_DIR)/sql \
$(MAGIC_FRAGMENT_DIR)/ssh \
$(MAGIC_FRAGMENT_DIR)/ssl \
$(MAGIC_FRAGMENT_DIR)/statistics \
$(MAGIC_FRAGMENT_DIR)/subtitle \
$(MAGIC_FRAGMENT_DIR)/sun \
$(MAGIC_FRAGMENT_DIR)/sylk \
$(MAGIC_FRAGMENT_DIR)/symbos \

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -165,8 +165,9 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
@ -177,6 +178,7 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
@ -265,6 +267,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@ -275,7 +278,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
#
# $File: Makefile.am,v 1.178 2022/04/02 14:47:42 christos Exp $
# $File: Makefile.am,v 1.182 2022/09/11 21:04:30 christos Exp $
#
MAGIC_FRAGMENT_BASE = Magdir
MAGIC_DIR = $(top_srcdir)/magic
@ -327,6 +330,7 @@ $(MAGIC_FRAGMENT_DIR)/bout \
$(MAGIC_FRAGMENT_DIR)/bsdi \
$(MAGIC_FRAGMENT_DIR)/bsi \
$(MAGIC_FRAGMENT_DIR)/btsnoop \
$(MAGIC_FRAGMENT_DIR)/burp \
$(MAGIC_FRAGMENT_DIR)/bytecode \
$(MAGIC_FRAGMENT_DIR)/c-lang \
$(MAGIC_FRAGMENT_DIR)/c64 \
@ -393,6 +397,7 @@ $(MAGIC_FRAGMENT_DIR)/fusecompress \
$(MAGIC_FRAGMENT_DIR)/games \
$(MAGIC_FRAGMENT_DIR)/gcc \
$(MAGIC_FRAGMENT_DIR)/gconv \
$(MAGIC_FRAGMENT_DIR)/gentoo \
$(MAGIC_FRAGMENT_DIR)/geo \
$(MAGIC_FRAGMENT_DIR)/geos \
$(MAGIC_FRAGMENT_DIR)/gimp \
@ -531,6 +536,7 @@ $(MAGIC_FRAGMENT_DIR)/pyramid \
$(MAGIC_FRAGMENT_DIR)/python \
$(MAGIC_FRAGMENT_DIR)/qt \
$(MAGIC_FRAGMENT_DIR)/revision \
$(MAGIC_FRAGMENT_DIR)/ringdove \
$(MAGIC_FRAGMENT_DIR)/riff \
$(MAGIC_FRAGMENT_DIR)/rpi \
$(MAGIC_FRAGMENT_DIR)/rpm \
@ -563,6 +569,7 @@ $(MAGIC_FRAGMENT_DIR)/sql \
$(MAGIC_FRAGMENT_DIR)/ssh \
$(MAGIC_FRAGMENT_DIR)/ssl \
$(MAGIC_FRAGMENT_DIR)/statistics \
$(MAGIC_FRAGMENT_DIR)/subtitle \
$(MAGIC_FRAGMENT_DIR)/sun \
$(MAGIC_FRAGMENT_DIR)/sylk \
$(MAGIC_FRAGMENT_DIR)/symbos \
@ -695,7 +702,6 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am

View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -120,7 +120,7 @@ am__can_run_installinfo = \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in
am__DIST_COMMON = $(srcdir)/Makefile.in README.md
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgdatadir = @pkgdatadir@
ACLOCAL = @ACLOCAL@
@ -135,8 +135,9 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
@ -147,6 +148,7 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
@ -235,6 +237,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@ -290,7 +293,6 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am

View File

@ -272,20 +272,42 @@ def open(flags):
Returns a magic object on success and None on failure.
Flags argument as for setflags.
"""
return Magic(_open(flags))
magic_t = _open(flags)
if magic_t is None:
return None
return Magic(magic_t)
# Objects used by `detect_from_` functions
class error(Exception):
pass
class MagicDetect(object):
def __init__(self):
self.mime_magic = Magic(_open(MAGIC_MIME))
self.mime_magic.load()
self.none_magic = Magic(_open(MAGIC_NONE))
self.none_magic.load()
self.mime_magic = open(MAGIC_MIME)
if self.mime_magic is None:
raise error
if self.mime_magic.load() == -1:
self.mime_magic.close()
self.mime_magic = None
raise error
self.none_magic = open(MAGIC_NONE)
if self.none_magic is None:
self.mime_magic.close()
self.mime_magic = None
raise error
if self.none_magic.load() == -1:
self.none_magic.close()
self.none_magic = None
self.mime_magic.close()
self.mime_magic = None
raise error
def __del__(self):
self.mime_magic.close()
self.none_magic.close()
if self.mime_magic is not None:
self.mime_magic.close()
if self.none_magic is not None:
self.none_magic.close()
threadlocal = threading.local()

View File

@ -8,7 +8,7 @@
class MagicTestCase(unittest.TestCase):
filename = 'magic.py'
expected_mime_type = 'text/x-python'
expected_mime_type = 'text/x-script.python'
expected_encoding = 'us-ascii'
expected_name = 'Python script, ASCII text executable'
@ -22,11 +22,11 @@ def test_detect_from_filename(self):
self.assert_result(result)
def test_detect_from_fobj(self):
with open(self.filename) as fobj:
with open(self.filename, "rb") as fobj:
result = magic.detect_from_fobj(fobj)
self.assert_result(result)
def test_detect_from_content(self):
with open(self.filename) as fobj:
result = magic.detect_from_content(fobj.read(4096))
with open(self.filename, "rb") as fobj:
result = magic.detect_from_content(fobj.read(8192))
self.assert_result(result)

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -229,8 +229,6 @@ am__define_uniq_tagged_files = \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
asctime_r.c asprintf.c ctime_r.c dprintf.c fmtcheck.c \
getline.c getopt_long.c gmtime_r.c localtime_r.c pread.c \
@ -249,8 +247,9 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
@ -261,6 +260,7 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
@ -349,6 +349,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@ -653,7 +654,6 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
@ -699,7 +699,8 @@ installdirs:
done
install: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-am
install-exec: install-exec-am
install-exec: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-exec-am
install-data: install-data-am
uninstall: uninstall-am
@ -870,7 +871,7 @@ ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \
uninstall-nodist_includeHEADERS
.MAKE: all check install install-am install-strip
.MAKE: all check install install-am install-exec install-strip
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \

View File

@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: apprentice.c,v 1.324 2022/05/31 18:54:25 christos Exp $")
FILE_RCSID("@(#)$File: apprentice.c,v 1.326 2022/09/13 18:46:07 christos Exp $")
#endif /* lint */
#include "magic.h"
@ -295,6 +295,7 @@ static const struct type_tbl_s type_tbl[] = {
{ XX("msdostime"), FILE_MSDOSTIME, FILE_FMT_STR },
{ XX("lemsdostime"), FILE_LEMSDOSTIME, FILE_FMT_STR },
{ XX("bemsdostime"), FILE_BEMSDOSTIME, FILE_FMT_STR },
{ XX("octal"), FILE_OCTAL, FILE_FMT_STR },
{ XX_NULL, FILE_INVALID, FILE_FMT_NONE },
};
@ -306,6 +307,7 @@ static const struct type_tbl_s special_tbl[] = {
{ XX("der"), FILE_DER, FILE_FMT_STR },
{ XX("name"), FILE_NAME, FILE_FMT_STR },
{ XX("use"), FILE_USE, FILE_FMT_STR },
{ XX("octal"), FILE_OCTAL, FILE_FMT_STR },
{ XX_NULL, FILE_INVALID, FILE_FMT_NONE },
};
# undef XX
@ -1002,6 +1004,7 @@ apprentice_magic_strength_1(const struct magic *m)
case FILE_PSTRING:
case FILE_STRING:
case FILE_OCTAL:
val += m->vallen * MULT;
break;
@ -1065,6 +1068,7 @@ apprentice_magic_strength_1(const struct magic *m)
}
/*ARGSUSED*/
private size_t
apprentice_magic_strength(const struct magic *m,
size_t nmagic __attribute__((__unused__)))
@ -1233,6 +1237,7 @@ set_test_type(struct magic *mstart, struct magic *m)
case FILE_MSDOSTIME:
case FILE_BEMSDOSTIME:
case FILE_LEMSDOSTIME:
case FILE_OCTAL:
mstart->flag |= BINTEST;
break;
case FILE_STRING:
@ -1292,7 +1297,8 @@ addentry(struct magic_set *ms, struct magic_entry *me,
(void)memset(&mp[mset[i].count], 0, sizeof(*mp) *
ALLOC_INCR);
mset[i].me = mp;
mset[i].max = incr;
mset[i].max = CAST(uint32_t, incr);
assert(mset[i].max == incr);
}
mset[i].me[mset[i].count++] = *me;
memset(me, 0, sizeof(*me));
@ -1694,6 +1700,7 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
case FILE_CLEAR:
case FILE_DER:
case FILE_GUID:
case FILE_OCTAL:
break;
default:
if (ms->flags & MAGIC_CHECK)
@ -2168,6 +2175,9 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
case 'I':
m->in_type = FILE_BEID3;
break;
case 'o':
m->in_type = FILE_OCTAL;
break;
case 'q':
m->in_type = FILE_LEQUAD;
break;
@ -2418,6 +2428,7 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
* parse a STRENGTH annotation line from magic file, put into magic[index - 1]
* if valid
*/
/*ARGSUSED*/
private int
parse_strength(struct magic_set *ms, struct magic_entry *me, const char *line,
size_t len __attribute__((__unused__)))
@ -2832,6 +2843,7 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
case FILE_NAME:
case FILE_USE:
case FILE_DER:
case FILE_OCTAL:
*p = getstr(ms, m, *p, action == FILE_COMPILE);
if (*p == NULL) {
if (ms->flags & MAGIC_CHECK)

View File

@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: compress.c,v 1.135 2022/04/11 18:14:41 christos Exp $")
FILE_RCSID("@(#)$File: compress.c,v 1.136 2022/09/13 16:08:34 christos Exp $")
#endif
#include "magic.h"
@ -989,7 +989,10 @@ uncompressbuf(int fd, size_t bytes_max, size_t method, const unsigned char *old,
goto err;
}
rv = OKDATA;
errno = 0;
r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0);
if (r == 0 && errno == 0)
goto ok;
if (r <= 0) {
DPRINTF("Read stdout failed %d (%s)\n", fdp[STDOUT_FILENO][0],
r != -1 ? strerror(errno) : "no data");

View File

@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: der.c,v 1.22 2022/01/10 14:15:08 christos Exp $")
FILE_RCSID("@(#)$File: der.c,v 1.24 2022/07/30 18:08:36 christos Exp $")
#endif
#else
#define SIZE_T_FORMAT "z"
@ -331,21 +331,26 @@ der_cmp(struct magic_set *ms, struct magic *m)
buf, s);
size_t slen = strlen(buf);
if (strncmp(buf, s, slen) != 0)
if (strncmp(buf, s, slen) != 0) {
DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
return 0;
}
s += slen;
again:
switch (*s) {
case '\0':
DPRINTF(("%s: EOF match\n", __func__));
return 1;
case '=':
s++;
goto val;
default:
if (!isdigit(CAST(unsigned char, *s)))
if (!isdigit(CAST(unsigned char, *s))) {
DPRINTF(("%s: no digit %c\n", __func__, *s));
return 0;
}
slen = 0;
do
@ -354,8 +359,10 @@ der_cmp(struct magic_set *ms, struct magic *m)
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "%s: len %" SIZE_T_FORMAT "u %u\n",
__func__, slen, tlen);
if (tlen != slen)
if (tlen != slen) {
DPRINTF(("%s: len %u != %zu\n", __func__, tlen, slen));
return 0;
}
goto again;
}
val:
@ -364,9 +371,12 @@ der_cmp(struct magic_set *ms, struct magic *m)
der_data(buf, sizeof(buf), tag, b + offs, tlen);
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "%s: data %s %s\n", __func__, buf, s);
if (strcmp(buf, s) != 0 && strcmp("x", s) != 0)
if (strcmp(buf, s) != 0 && strcmp("x", s) != 0) {
DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
return 0;
}
strlcpy(ms->ms_value.s, buf, sizeof(ms->ms_value.s));
DPRINTF(("%s: complete match\n", __func__));
return 1;
}
#endif

View File

@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: encoding.c,v 1.38 2022/06/10 13:40:17 christos Exp $")
FILE_RCSID("@(#)$File: encoding.c,v 1.39 2022/09/13 18:46:07 christos Exp $")
#endif /* lint */
#include "magic.h"
@ -486,9 +486,11 @@ looks_ucs16(const unsigned char *bf, size_t nbytes, file_unichar_t *ubf,
uint32_t uc;
if (bigend)
uc = bf[i + 1] | (CAST(file_unichar_t, bf[i]) << 8);
uc = CAST(uint32_t,
bf[i + 1] | (CAST(file_unichar_t, bf[i]) << 8));
else
uc = bf[i] | (CAST(file_unichar_t, bf[i + 1]) << 8);
uc = CAST(uint32_t,
bf[i] | (CAST(file_unichar_t, bf[i + 1]) << 8));
uc &= 0xffff;

View File

@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: file.c,v 1.196 2022/07/04 17:00:51 christos Exp $")
FILE_RCSID("@(#)$File: file.c,v 1.204 2022/09/13 18:46:07 christos Exp $")
#endif /* lint */
#include "magic.h"
@ -60,6 +60,12 @@ FILE_RCSID("@(#)$File: file.c,v 1.196 2022/07/04 17:00:51 christos Exp $")
#ifdef HAVE_WCTYPE_H
#include <wctype.h>
#endif
#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH) && \
defined(HAVE_WCTYPE_H)
#define FILE_WIDE_SUPPORT
#else
#include <ctype.h>
#endif
#if defined(HAVE_GETOPT_H) && defined(HAVE_STRUCT_OPTION)
# include <getopt.h>
@ -507,7 +513,7 @@ unwrap(struct magic_set *ms, const char *fn)
int wid = 0, cwid;
int e = 0;
size_t fi = 0, fimax = 100;
char **flist = malloc(sizeof(*flist) * fimax);
char **flist = CAST(char **, malloc(sizeof(*flist) * fimax));
if (flist == NULL)
out: file_err(EXIT_FAILURE, "Cannot allocate memory for file list");
@ -526,9 +532,11 @@ out: file_err(EXIT_FAILURE, "Cannot allocate memory for file list");
line[len - 1] = '\0';
if (fi >= fimax) {
fimax += 100;
char **nf = realloc(flist, fimax * sizeof(*flist));
char **nf = CAST(char **,
realloc(flist, fimax * sizeof(*flist)));
if (nf == NULL)
goto out;
flist = nf;
}
flist[fi++] = line;
cwid = file_mbswidth(ms, line);
@ -550,6 +558,58 @@ out: file_err(EXIT_FAILURE, "Cannot allocate memory for file list");
return e;
}
private void
file_octal(unsigned char c)
{
putc('\\', stdout);
putc(((c >> 6) & 7) + '0', stdout);
putc(((c >> 3) & 7) + '0', stdout);
putc(((c >> 0) & 7) + '0', stdout);
}
private void
fname_print(const char *inname)
{
size_t n = strlen(inname);
#ifdef FILE_WIDE_SUPPORT
mbstate_t state;
wchar_t nextchar;
size_t bytesconsumed;
(void)memset(&state, 0, sizeof(state));
while (n > 0) {
bytesconsumed = mbrtowc(&nextchar, inname, n, &state);
if (bytesconsumed == CAST(size_t, -1) ||
bytesconsumed == CAST(size_t, -2)) {
nextchar = *inname++;
n--;
(void)memset(&state, 0, sizeof(state));
file_octal(CAST(unsigned char, nextchar));
continue;
}
inname += bytesconsumed;
n -= bytesconsumed;
if (iswprint(nextchar)) {
printf("%lc", (wint_t)nextchar);
continue;
}
/* XXX: What if it is > 255? */
file_octal(CAST(unsigned char, nextchar));
}
#else
size_t i;
for (i = 0; i < n; i++) {
unsigned char c = CAST(unsigned char, inname[i]);
if (isprint(c)) {
putc(c);
continue;
}
file_octal(c);
}
#endif
}
/*
* Called for each input file on the command line (or in a list of files)
*/
@ -559,15 +619,13 @@ process(struct magic_set *ms, const char *inname, int wid)
const char *type, c = nulsep > 1 ? '\0' : '\n';
int std_in = strcmp(inname, "-") == 0;
int haderror = 0;
size_t plen = 4 * wid + 1;
char *pbuf, *pname;
if ((pbuf = CAST(char *, malloc(plen))) == NULL)
file_err(EXIT_FAILURE, "Can't allocate %zu bytes", plen);
if (wid > 0 && !bflag) {
pname = file_printable(ms, pbuf, plen, inname, wid);
(void)printf("%s", std_in ? "/dev/stdin" : pname);
const char *pname = std_in ? "/dev/stdin" : inname;
if ((ms->flags & MAGIC_RAW) == 0)
fname_print(pname);
else
(void)printf("%s", pname);
if (nulsep)
(void)putc('\0', stdout);
if (nulsep < 2) {
@ -586,7 +644,6 @@ process(struct magic_set *ms, const char *inname, int wid)
}
if (nobuffer)
haderror |= fflush(stdout) != 0;
free(pbuf);
return haderror || type == NULL;
}
@ -594,35 +651,37 @@ protected size_t
file_mbswidth(struct magic_set *ms, const char *s)
{
size_t width = 0;
#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH) && \
defined(HAVE_WCTYPE_H)
size_t bytesconsumed, old_n, n;
#ifdef FILE_WIDE_SUPPORT
size_t bytesconsumed, n;
mbstate_t state;
wchar_t nextchar;
(void)memset(&state, 0, sizeof(mbstate_t));
old_n = n = strlen(s);
(void)memset(&state, 0, sizeof(state));
n = strlen(s);
while (n > 0) {
bytesconsumed = mbrtowc(&nextchar, s, n, &state);
if (bytesconsumed == CAST(size_t, -1) ||
bytesconsumed == CAST(size_t, -2)) {
/* Something went wrong, return something reasonable */
return old_n;
nextchar = *s;
bytesconsumed = 1;
(void)memset(&state, 0, sizeof(state));
width += 4;
} else {
int w = wcwidth(nextchar);
width += ((ms->flags & MAGIC_RAW) != 0
|| iswprint(nextchar)) ? (w > 0 ? w : 1) : 4;
}
width += ((ms->flags & MAGIC_RAW) != 0
|| iswprint(nextchar)) ? wcwidth(nextchar) : 4;
s += bytesconsumed, n -= bytesconsumed;
}
return width;
#else
while (*s) {
for (; *s; s++) {
width += (ms->flags & MAGIC_RAW) != 0
|| isprint(CAST(unsigned char, *s)) ? 1 : 4;
}
return strlen(s);
#endif
return width;
}
private void

View File

@ -27,7 +27,7 @@
*/
/*
* file.h - definitions for file(1) program
* @(#)$File: file.h,v 1.234 2022/05/28 20:24:09 christos Exp $
* @(#)$File: file.h,v 1.237 2022/09/10 13:21:42 christos Exp $
*/
#ifndef __file_h__
@ -161,7 +161,7 @@
#define MAXstring 128 /* max len of "string" types */
#define MAGICNO 0xF11E041C
#define VERSIONNO 17
#define VERSIONNO 18
#define FILE_MAGICSIZE 376
#define FILE_GUID_SIZE sizeof("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")
@ -278,7 +278,8 @@ struct magic {
#define FILE_MSDOSTIME 56
#define FILE_LEMSDOSTIME 57
#define FILE_BEMSDOSTIME 58
#define FILE_NAMES_SIZE 59 /* size of array to contain all names */
#define FILE_OCTAL 59
#define FILE_NAMES_SIZE 60 /* size of array to contain all names */
#define IS_STRING(t) \
((t) == FILE_STRING || \
@ -289,7 +290,8 @@ struct magic {
(t) == FILE_SEARCH || \
(t) == FILE_INDIRECT || \
(t) == FILE_NAME || \
(t) == FILE_USE)
(t) == FILE_USE || \
(t) == FILE_OCTAL)
#define FILE_FMT_NONE 0
#define FILE_FMT_NUM 1 /* "cduxXi" */
@ -508,8 +510,9 @@ struct stat;
protected const char *file_fmtdatetime(char *, size_t, uint64_t, int);
protected const char *file_fmtdate(char *, size_t, uint16_t);
protected const char *file_fmttime(char *, size_t, uint16_t);
protected const char *file_fmtvarint(const unsigned char *, int, char *,
size_t);
protected const char *file_fmtvarint(char *, size_t, const unsigned char *,
int);
protected const char *file_fmtnum(char *, size_t, const char *, int);
protected struct magic_set *file_ms_alloc(int);
protected void file_ms_free(struct magic_set *);
protected int file_default(struct magic_set *, size_t);
@ -575,7 +578,7 @@ protected size_t file_pstring_length_size(struct magic_set *,
const struct magic *);
protected size_t file_pstring_get_length(struct magic_set *,
const struct magic *, const char *);
public char * file_printable(struct magic_set *, char *, size_t,
protected char * file_printable(struct magic_set *, char *, size_t,
const char *, size_t);
#ifdef __EMX__
protected int file_os2_apptype(struct magic_set *, const char *, const void *,

View File

@ -4,7 +4,7 @@
* The first column specifies the short name, if any, or 0 if none.
* The second column specifies the long name.
* The third column specifies whether it takes a parameter.
* The fourth columns specifies whether is is marked as "default"
* The fourth column specifies whether is marked as "default"
* if POSIXLY_CORRECT is defined: 1,
* if POSIXLY_CORRECT is not defined: 2.
* The fifth column is the documentation.

View File

@ -29,6 +29,9 @@
*/
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: fmtcheck.c,v 1.4 2022/09/13 18:46:07 christos Exp $")
#endif /* lint */
#include <stdio.h>
#include <string.h>

View File

@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: funcs.c,v 1.129 2022/05/28 20:24:09 christos Exp $")
FILE_RCSID("@(#)$File: funcs.c,v 1.131 2022/09/13 18:46:07 christos Exp $")
#endif /* lint */
#include "magic.h"
@ -686,6 +686,7 @@ file_regcomp(struct magic_set *ms file_locale_used, file_regex_t *rx,
return rc;
}
/*ARGSUSED*/
protected int
file_regexec(struct magic_set *ms file_locale_used, file_regex_t *rx,
const char *str, size_t nmatch, regmatch_t* pmatch, int eflags)
@ -763,7 +764,7 @@ file_pop_buffer(struct magic_set *ms, file_pushbuf_t *pb)
/*
* convert string to ascii printable format.
*/
public char *
protected char *
file_printable(struct magic_set *ms, char *buf, size_t bufsiz,
const char *str, size_t slen)
{

View File

@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: is_json.c,v 1.20 2022/05/28 00:44:22 christos Exp $")
FILE_RCSID("@(#)$File: is_json.c,v 1.26 2022/09/13 18:46:07 christos Exp $")
#endif
#include "magic.h"
@ -122,6 +122,7 @@ json_skip_space(const unsigned char *uc, const unsigned char *ue)
return uc;
}
/*ARGSUSED*/
static int
json_parse_string(const unsigned char **ucp, const unsigned char *ue,
size_t lvl __file_debugused)
@ -183,6 +184,9 @@ json_parse_array(const unsigned char **ucp, const unsigned char *ue,
DPRINTF("Parse array: ", uc, *ucp);
while (uc < ue) {
uc = json_skip_space(uc, ue);
if (uc == ue)
goto out;
if (*uc == ']')
goto done;
if (!json_parse(&uc, ue, st, lvl + 1))
@ -265,6 +269,7 @@ json_parse_object(const unsigned char **ucp, const unsigned char *ue,
return 0;
}
/*ARGSUSED*/
static int
json_parse_number(const unsigned char **ucp, const unsigned char *ue,
size_t lvl __file_debugused)
@ -316,6 +321,7 @@ json_parse_number(const unsigned char **ucp, const unsigned char *ue,
return got;
}
/*ARGSUSED*/
static int
json_parse_const(const unsigned char **ucp, const unsigned char *ue,
const char *str, size_t len, size_t lvl __file_debugused)
@ -323,25 +329,28 @@ json_parse_const(const unsigned char **ucp, const unsigned char *ue,
const unsigned char *uc = *ucp;
DPRINTF("Parse const: ", uc, *ucp);
for (len--; uc < ue && --len;) {
if (*uc++ == *++str)
continue;
*ucp += --len - 1;
if (*ucp > ue)
*ucp = ue;
for (; uc < ue && --len;) {
if (*uc++ != *++str) {
DPRINTF("Bad const: ", uc, *ucp);
return 0;
}
}
if (len)
DPRINTF("Bad const: ", uc, *ucp);
*ucp = uc;
return len == 0;
DPRINTF("Good const: ", uc, *ucp);
return 1;
}
static int
json_parse(const unsigned char **ucp, const unsigned char *ue,
size_t *st, size_t lvl)
{
const unsigned char *uc;
const unsigned char *uc, *ouc;
int rv = 0;
int t;
uc = json_skip_space(*ucp, ue);
ouc = uc = json_skip_space(*ucp, ue);
if (uc == ue)
goto out;
@ -395,8 +404,16 @@ json_parse(const unsigned char **ucp, const unsigned char *ue,
out:
DPRINTF("End general: ", uc, *ucp);
*ucp = uc;
if (lvl == 0)
return rv && uc == ue && (st[JSON_ARRAYN] || st[JSON_OBJECT]);
if (lvl == 0) {
if (!rv)
return 0;
if (uc == ue)
return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
if (*ouc == *uc && json_parse(&uc, ue, st, 1))
return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
else
return 0;
}
return rv;
}
@ -408,6 +425,7 @@ file_is_json(struct magic_set *ms, const struct buffer *b)
const unsigned char *ue = uc + b->flen;
size_t st[JSON_MAX];
int mime = ms->flags & MAGIC_MIME;
int jt;
if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
@ -415,17 +433,19 @@ file_is_json(struct magic_set *ms, const struct buffer *b)
memset(st, 0, sizeof(st));
if (!json_parse(&uc, ue, st, 0))
if ((jt = json_parse(&uc, ue, st, 0)) == 0)
return 0;
if (mime == MAGIC_MIME_ENCODING)
return 1;
if (mime) {
if (file_printf(ms, "application/json") == -1)
if (file_printf(ms, "application/%s",
jt == 1 ? "json" : "x-ndjason") == -1)
return -1;
return 1;
}
if (file_printf(ms, "JSON text data") == -1)
if (file_printf(ms, "%sJSON text data",
jt == 1 ? "" : "New Line Delimited ") == -1)
return -1;
#if JSON_COUNT
#define P(n) st[n], st[n] > 1 ? "s" : ""

View File

@ -40,7 +40,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: is_tar.c,v 1.44 2019/02/20 02:35:27 christos Exp $")
FILE_RCSID("@(#)$File: is_tar.c,v 1.47 2022/09/13 18:46:07 christos Exp $")
#endif
#include "magic.h"
@ -98,15 +98,28 @@ file_is_tar(struct magic_set *ms, const struct buffer *b)
private int
is_tar(const unsigned char *buf, size_t nbytes)
{
static const char gpkg_match[] = "/gpkg-1";
const union record *header = RCAST(const union record *,
RCAST(const void *, buf));
size_t i;
int sum, recsum;
const unsigned char *p, *ep;
const char *nulp;
if (nbytes < sizeof(*header))
return 0;
/* If the file looks like Gentoo GLEP 78 binary package (GPKG),
* don't waste time on further checks and fall back to magic rules.
*/
nulp = CAST(const char *,
memchr(header->header.name, 0, sizeof(header->header.name)));
if (nulp != NULL && nulp >= header->header.name + sizeof(gpkg_match) &&
memcmp(nulp - sizeof(gpkg_match) + 1, gpkg_match,
sizeof(gpkg_match)) == 0)
return 0;
recsum = from_oct(header->header.chksum, sizeof(header->header.chksum));
sum = 0;

View File

@ -25,6 +25,10 @@
* SUCH DAMAGE.
*/
#ifndef lint
FILE_RCSID("@(#)$File: memtest.c,v 1.3 2022/09/13 18:46:07 christos Exp $")
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>

View File

@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: print.c,v 1.90 2021/10/24 15:52:18 christos Exp $")
FILE_RCSID("@(#)$File: print.c,v 1.92 2022/09/10 13:21:42 christos Exp $")
#endif /* lint */
#include <string.h>
@ -200,7 +200,7 @@ file_mdump(struct magic *m)
case FILE_LEVARINT:
case FILE_BEVARINT:
(void)fprintf(stderr, "%s", file_fmtvarint(
m->value.us, m->type, tbuf, sizeof(tbuf)));
tbuf, sizeof(tbuf), m->value.us, m->type));
break;
case FILE_MSDOSDATE:
case FILE_BEMSDOSDATE:
@ -214,6 +214,10 @@ file_mdump(struct magic *m)
(void)fprintf(stderr, "%s,",
file_fmttime(tbuf, sizeof(tbuf), m->value.h));
break;
case FILE_OCTAL:
(void)fprintf(stderr, "%s",
file_fmtnum(tbuf, sizeof(tbuf), m->value.s, 8));
break;
case FILE_DEFAULT:
/* XXX - do anything here? */
break;
@ -257,7 +261,7 @@ file_magwarn(struct magic_set *ms, const char *f, ...)
}
protected const char *
file_fmtvarint(const unsigned char *us, int t, char *buf, size_t blen)
file_fmtvarint(char *buf, size_t blen, const unsigned char *us, int t)
{
snprintf(buf, blen, "%jd", file_varint2uintmax_t(us, t, NULL));
return buf;
@ -340,3 +344,21 @@ file_fmttime(char *buf, size_t bsize, uint16_t v)
return buf;
}
protected const char *
file_fmtnum(char *buf, size_t blen, const char *us, int base)
{
char *endptr;
unsigned long long val;
errno = 0;
val = strtoull(us, &endptr, base);
if (*endptr || errno) {
bad: strlcpy(buf, "*Invalid number*", blen);
return buf;
}
if (snprintf(buf, blen, "%llu", val) < 0)
goto bad;
return buf;
}

View File

@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: readelf.c,v 1.180 2022/01/10 14:15:08 christos Exp $")
FILE_RCSID("@(#)$File: readelf.c,v 1.182 2022/07/31 16:01:01 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@ -62,6 +62,7 @@ private uint64_t getu64(int, uint64_t);
#define MAX_PHNUM 128
#define MAX_SHNUM 32768
#define MAX_SHSIZE (64 * 1024 * 1024)
#define SIZE_UNKNOWN CAST(off_t, -1)
private int
@ -896,6 +897,13 @@ do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
int adjust = 1;
if (prpsoffsets(k) >= prpsoffsets(i))
continue;
/*
* pr_fname == pr_psargs - 16 &&
* non-nul-terminated fname (qemu)
*/
if (prpsoffsets(k) ==
prpsoffsets(i) - 16 && j == 16)
continue;
for (no = doff + prpsoffsets(k);
no < doff + prpsoffsets(i); no++)
adjust = adjust
@ -1442,6 +1450,12 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
return -1;
return 0;
}
if (xsh_size > MAX_SHSIZE) {
file_error(ms, errno, "Note section size too "
"big (%ju > %u)", (uintmax_t)xsh_size,
MAX_SHSIZE);
return -1;
}
if ((nbuf = malloc(xsh_size)) == NULL) {
file_error(ms, errno, "Cannot allocate memory"
" for note");

View File

@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: seccomp.c,v 1.21 2021/09/24 14:17:24 christos Exp $")
FILE_RCSID("@(#)$File: seccomp.c,v 1.22 2022/07/30 16:49:18 christos Exp $")
#endif /* lint */
#if HAVE_LIBSECCOMP
@ -177,7 +177,9 @@ enable_sandbox_full(void)
#endif
ALLOW_RULE(fcntl);
ALLOW_RULE(fcntl64);
#ifdef __NR_fstat
ALLOW_RULE(fstat);
#endif
ALLOW_RULE(fstat64);
#ifdef __NR_fstatat64
ALLOW_RULE(fstatat64);

View File

@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: softmagic.c,v 1.323 2022/05/28 00:44:22 christos Exp $")
FILE_RCSID("@(#)$File: softmagic.c,v 1.328 2022/09/13 18:46:07 christos Exp $")
#endif /* lint */
#include "magic.h"
@ -43,7 +43,7 @@ FILE_RCSID("@(#)$File: softmagic.c,v 1.323 2022/05/28 00:44:22 christos Exp $")
#include <time.h>
#include "der.h"
private int match(struct magic_set *, struct magic *, file_regex_t **, uint32_t,
private int match(struct magic_set *, struct magic *, file_regex_t **, size_t,
const struct buffer *, size_t, int, int, int, uint16_t *,
uint16_t *, int *, int *, int *, int *);
private int mget(struct magic_set *, struct magic *, const struct buffer *,
@ -118,7 +118,7 @@ file_softmagic(struct magic_set *ms, const struct buffer *b,
uint16_t *indir_count, uint16_t *name_count, int mode, int text)
{
struct mlist *ml;
int rv, printed_something = 0, need_separator = 0;
int rv = 0, printed_something = 0, need_separator = 0;
uint16_t nc, ic;
if (name_count == NULL) {
@ -130,13 +130,24 @@ file_softmagic(struct magic_set *ms, const struct buffer *b,
indir_count = &ic;
}
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
if ((rv = match(ms, ml->magic, ml->magic_rxcomp, ml->nmagic, b,
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next) {
int ret = match(ms, ml->magic, ml->magic_rxcomp, ml->nmagic, b,
0, mode, text, 0, indir_count, name_count,
&printed_something, &need_separator, NULL, NULL)) != 0)
return rv;
&printed_something, &need_separator, NULL, NULL);
switch (ret) {
case -1:
return ret;
case 0:
continue;
default:
if ((ms->flags & MAGIC_CONTINUE) == 0)
return ret;
rv = ret;
break;
}
}
return 0;
return rv;
}
#define FILE_FMTDEBUG
@ -192,7 +203,7 @@ file_fmtcheck(struct magic_set *ms, const char *desc, const char *def,
*/
private int
match(struct magic_set *ms, struct magic *magic, file_regex_t **magic_rxcomp,
uint32_t nmagic, const struct buffer *b, size_t offset, int mode, int text,
size_t nmagic, const struct buffer *b, size_t offset, int mode, int text,
int flip, uint16_t *indir_count, uint16_t *name_count,
int *printed_something, int *need_separator, int *returnval,
int *found_match)
@ -201,7 +212,8 @@ match(struct magic_set *ms, struct magic *magic, file_regex_t **magic_rxcomp,
unsigned int cont_level = 0;
int found_matchv = 0; /* if a match is found it is set to 1*/
int returnvalv = 0, e;
int firstline = 1; /* a flag to print X\n X\n- X */
/* a flag to print X\n X\n- X */
int firstline = !(*printed_something || *need_separator);
struct buffer bb;
int print = (ms->flags & MAGIC_NODESC) == 0;
@ -804,6 +816,11 @@ mprint(struct magic_set *ms, struct magic *m)
file_fmttime(tbuf, sizeof(tbuf), p->h)) == -1)
return -1;
break;
case FILE_OCTAL:
file_fmtnum(buf, sizeof(buf), m->value.s, 8);
if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
return -1;
break;
default:
file_magerror(ms, "invalid m->type (%d) in mprint()", m->type);
return -1;
@ -852,6 +869,7 @@ moffset(struct magic_set *ms, struct magic *m, const struct buffer *b,
case FILE_PSTRING:
case FILE_BESTRING16:
case FILE_LESTRING16:
case FILE_OCTAL:
if (m->reln == '=' || m->reln == '!') {
o = ms->offset + m->vallen;
} else {
@ -1162,7 +1180,8 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
return 1;
case FILE_STRING:
case FILE_BESTRING16:
case FILE_LESTRING16: {
case FILE_LESTRING16:
case FILE_OCTAL: {
/* Null terminate and eat *trailing* return */
p->s[sizeof(p->s) - 1] = '\0';
return 1;
@ -1649,6 +1668,11 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
return 0;
off = SEXT(sgn,64,LE64(q));
break;
case FILE_OCTAL:
if (OFFSET_OOB(nbytes, offset, m->vallen))
return 0;
off = SEXT(sgn,64,strtoull(p->s, NULL, 8));
break;
default:
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "bad op=%d\n", op);
@ -1716,6 +1740,12 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
return 0;
offset = do_ops(m, SEXT(sgn,64,BE64(p)), off);
break;
case FILE_OCTAL:
if (OFFSET_OOB(nbytes, offset, m->vallen))
return 0;
offset = do_ops(m,
SEXT(sgn,64,strtoull(p->s, NULL, 8)), off);
break;
default:
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "bad in_type=%d\n", in_type);
@ -1800,6 +1830,7 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
case FILE_STRING:
case FILE_PSTRING:
case FILE_SEARCH:
case FILE_OCTAL:
if (OFFSET_OOB(nbytes, offset, m->vallen))
return 0;
break;
@ -1831,8 +1862,8 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
{
if ((rv = match(ms, mlp->magic, mlp->magic_rxcomp,
mlp->nmagic, &bb, 0, BINTEST, text, 0, indir_count,
name_count, printed_something, need_separator, NULL,
NULL)) != 0)
name_count, printed_something, need_separator,
NULL, NULL)) != 0)
break;
}
@ -2158,6 +2189,7 @@ magiccheck(struct magic_set *ms, struct magic *m, file_regex_t **m_cache)
case FILE_STRING:
case FILE_PSTRING:
case FILE_OCTAL:
l = 0;
v = file_strncmp(m->value.s, p->s, CAST(size_t, m->vallen),
sizeof(p->s), m->str_flags);
@ -2265,7 +2297,6 @@ magiccheck(struct magic_set *ms, struct magic *m, file_regex_t **m_cache)
default:
return -1;
break;
}
break;
}
@ -2279,7 +2310,7 @@ magiccheck(struct magic_set *ms, struct magic *m, file_regex_t **m_cache)
if (matched == -1) {
if ((ms->flags & MAGIC_DEBUG) != 0) {
(void) fprintf(stderr,
"EOF comparing DER entries");
"EOF comparing DER entries\n");
}
return 0;
}

View File

@ -18,6 +18,9 @@
/* OPENBSD ORIGINAL: lib/libc/string/strlcat.c */
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: strlcat.c,v 1.3 2022/09/13 18:46:07 christos Exp $")
#endif
#include <sys/types.h>
#include <string.h>

View File

@ -18,6 +18,9 @@
/* OPENBSD ORIGINAL: lib/libc/string/strlcpy.c */
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: strlcpy.c,v 1.3 2022/09/13 18:46:07 christos Exp $")
#endif
#include <sys/types.h>
#include <string.h>

View File

@ -108,7 +108,7 @@ you use strange formats.
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: vasprintf.c,v 1.19 2021/02/23 00:51:11 christos Exp $")
FILE_RCSID("@(#)$File: vasprintf.c,v 1.20 2022/07/30 17:04:18 christos Exp $")
#endif /* lint */
#include <assert.h>
@ -635,7 +635,7 @@ int vasprintf(char **ptr, const char *format_string, va_list vargs)
# ifdef WIN32
s.vargs = vargs;
# else
memcpy (&s.vargs, &vargs, sizeof (s.va_args));
memcpy (&s.vargs, &vargs, sizeof (s.vargs));
# endif /* WIN32 */
# endif /* __va_copy */
#endif /* va_copy */

View File

@ -17,6 +17,10 @@ bcachefs.result \
bcachefs.testfile \
cl8m8ocofedso.result \
cl8m8ocofedso.testfile \
dsd64-dff.result \
dsd64-dff.testfile \
dsd64-dsf.result \
dsd64-dsf.testfile \
escapevel.result \
escapevel.testfile \
ext4.result \
@ -25,6 +29,8 @@ fit-map-data.result \
fit-map-data.testfile \
gedcom.result \
gedcom.testfile \
gpkg-1-zst.result \
gpkg-1-zst.testfile \
hddrawcopytool.result \
hddrawcopytool.testfile \
issue311docx.result \
@ -41,6 +47,14 @@ json4.result \
json4.testfile \
json5.result \
json5.testfile \
json6.result \
json6.testfile \
json7.result \
json7.testfile \
json8.result \
json8.testfile \
jsonlines1.testfile \
jsonlines1.result \
matilde.arm.result \
matilde.arm.testfile \
pcjr.result \

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -167,8 +167,6 @@ am__define_uniq_tagged_files = \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgdatadir = @pkgdatadir@
@ -184,8 +182,9 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
@ -196,6 +195,7 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
@ -284,6 +284,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@ -309,6 +310,10 @@ bcachefs.result \
bcachefs.testfile \
cl8m8ocofedso.result \
cl8m8ocofedso.testfile \
dsd64-dff.result \
dsd64-dff.testfile \
dsd64-dsf.result \
dsd64-dsf.testfile \
escapevel.result \
escapevel.testfile \
ext4.result \
@ -317,6 +322,8 @@ fit-map-data.result \
fit-map-data.testfile \
gedcom.result \
gedcom.testfile \
gpkg-1-zst.result \
gpkg-1-zst.testfile \
hddrawcopytool.result \
hddrawcopytool.testfile \
issue311docx.result \
@ -333,6 +340,14 @@ json4.result \
json4.testfile \
json5.result \
json5.testfile \
json6.result \
json6.testfile \
json7.result \
json7.testfile \
json8.result \
json8.testfile \
jsonlines1.testfile \
jsonlines1.result \
matilde.arm.result \
matilde.arm.testfile \
pcjr.result \
@ -560,7 +575,6 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am

View File

@ -0,0 +1 @@
DSDIFF audio bitstream data, 1 bit, mono, "DSD 64" 2822400 Hz, no compression, ID3 version 2.0.0

Binary file not shown.

View File

@ -0,0 +1 @@
DSF audio bitstream data, 1 bit, mono, "DSD 64" 2822400 Hz, no compression, ID3 version 2.3.0

Binary file not shown.

View File

@ -0,0 +1 @@
Gentoo GLEP 78 (GPKG) binary package for "inkscape-1.2.1-r2-1" using zstd compression

Binary file not shown.

View File

@ -0,0 +1 @@
JSON text data

View File

@ -0,0 +1 @@
{"a":[ ]}

View File

@ -0,0 +1 @@
ASCII text

View File

@ -0,0 +1 @@
{"tag": tLue}

View File

@ -0,0 +1 @@
JSON text data

View File

@ -0,0 +1 @@
{"tag": true}

View File

@ -0,0 +1 @@
New Line Delimited JSON text data

View File

@ -0,0 +1,2 @@
{}
{}

View File

@ -60,6 +60,8 @@ slurp(FILE *fp, size_t *final_len)
}
*s++ = c;
}
if (s != l && s[-1] == '\n')
s--;
if (s == l + len)
l = (char *)xrealloc(l, len + 1);
*s++ = '\0';

View File

@ -114,8 +114,8 @@
/* Define to 1 if you have the `memmem' function. */
#define HAVE_MEMMEM 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <minix/config.h> header file. */
/* #undef HAVE_MINIX_CONFIG_H */
/* Define to 1 if you have the `mkostemp' function. */
#define HAVE_MKOSTEMP 1
@ -149,6 +149,9 @@
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
@ -299,7 +302,7 @@
#define PACKAGE_NAME "file"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "file 5.42"
#define PACKAGE_STRING "file 5.43"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "file"
@ -308,9 +311,11 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "5.42"
#define PACKAGE_VERSION "5.43"
/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#define STDC_HEADERS 1
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
@ -320,26 +325,92 @@
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
/* Enable general extensions on macOS. */
#ifndef _DARWIN_C_SOURCE
# define _DARWIN_C_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable X/Open compliant socket functions that do not require linking
with -lxnet on HP-UX 11.11. */
#ifndef _HPUX_ALT_XOPEN_SOCKET_API
# define _HPUX_ALT_XOPEN_SOCKET_API 1
#endif
/* Identify the host operating system as Minix.
This macro does not affect the system headers' behavior.
A future release of Autoconf may stop defining this macro. */
#ifndef _MINIX
/* # undef _MINIX */
#endif
/* Enable general extensions on NetBSD.
Enable NetBSD compatibility extensions on Minix. */
#ifndef _NETBSD_SOURCE
# define _NETBSD_SOURCE 1
#endif
/* Enable OpenBSD compatibility extensions on NetBSD.
Oddly enough, this does nothing on OpenBSD. */
#ifndef _OPENBSD_SOURCE
# define _OPENBSD_SOURCE 1
#endif
/* Define to 1 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_SOURCE
/* # undef _POSIX_SOURCE */
#endif
/* Define to 2 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_1_SOURCE
/* # undef _POSIX_1_SOURCE */
#endif
/* Enable POSIX-compatible threading on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
# define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
#endif
/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
# define __STDC_WANT_IEC_60559_BFP_EXT__ 1
#endif
/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
# define __STDC_WANT_IEC_60559_DFP_EXT__ 1
#endif
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
# define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
#endif
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
#endif
/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
#ifndef __STDC_WANT_LIB_EXT2__
# define __STDC_WANT_LIB_EXT2__ 1
#endif
/* Enable extensions specified by ISO/IEC 24747:2009. */
#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
# define __STDC_WANT_MATH_SPEC_FUNCS__ 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable X/Open extensions. Define to 500 only if necessary
to make mbstate_t available. */
#ifndef _XOPEN_SOURCE
/* # undef _XOPEN_SOURCE */
#endif
/* Version number of package */
#define VERSION "5.42"
#define VERSION "5.43"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
@ -359,11 +430,6 @@
/* Enable zlib compression support */
#define ZLIBSUPPORT 1
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
@ -373,16 +439,6 @@
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
@ -416,7 +472,7 @@
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to `int' if <sys/types.h> does not define. */
/* Define as a signed integer type capable of holding a process identifier. */
/* #undef pid_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */