Coder Social home page Coder Social logo

aha's Introduction

aha - Ansi HTML Adapter

Converts ANSI escape sequences of a unix terminal to HTML code.

aha screenshot

Examples

  • aha --help | aha --black --title "the awesome aha help"> aha-help.htm
    • Creates an HTML file of the help of aha with black background
  • colordiff oldfile.c newfile.c | aha > colordiff.htm
    • Creates an HTML file with a colorful diff-output of two files "oldfile.c" and "newfile.c" with white background
  • ls --color=always | aha --pink > ls.htm
  • Creates an HTML file with a colorful ls-output with pink background.
  • echo q | htop | aha --black --line-fix > htop.htm
    • Creates an HTML file with the output of htop. You have to use --line-fix due the other new-line-commands htop uses.
  • MAN_KEEP_FORMATTING=1 COLUMNS=80 man aha | ul | aha > man-aha.htm
    • Creates an HTML file with the man page of aha. Man uses nroff's bold and underline, which ul converts to SGR.

Compilation / Installation

Installation Options

OSX - Homebrew

  • brew install aha

Conda

  • conda install -n YOURENV -c conda-forge aha (and if you wish to make conda 10x faster, use mamba).

Build From Source

Aha has no dependencies except for a C compiler and make.

Clone this repo git clone https://github.com/theZiz/aha.git. Move into the repo directory cd aha. To compile just type make. To install aha to /usr/local/ type make install. You can change the installation directory with make install PREFIX=/your/path. You can override the man directory with make install MANDIR=/your/path/man

Licensing

All files are subjects to the LGPL2+ or the MPL1.1 (Dual licensed).

aha's People

Contributors

aaww01 avatar andrewkvalheim avatar bhaak avatar dannagle avatar eddieantonio avatar iamh2o avatar jwilk avatar krytarowski avatar polluks avatar rhendric avatar richq avatar suve avatar tedlyngmo avatar the-king-of-toasters avatar theziz avatar trombonehero avatar twopir avatar xtaran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aha's Issues

Reset sequence switches background to highlighted

While using the black color scheme, the SGR 'reset' parameter 0 turns the background of all following lines to white.

As an example, this line:
\033[1mLast segment %d (task index %d) completed: %s\033[0m
Gets turned into:
</span><span style="color:white;font-weight:bold;">Last segment 0 (task index 2) completed: Succeeded!</span><span style="color:white;"></span><span style="color:white;background-color:white;">

I'm by no mean well versed in those things, but I've looked into it a little and I believe this is caused by some of the content of the background color array having the wrong index.

need help explaining htop fix

Hi,
Could you help me understand how the htop fix works? I don't quite get the code.
I can't install aha on a server, but need to parse htop output and the only part I am still missing is how to replace the "newlines" in the output. I would love to have an example akin to `echo "weird htop newline"|sed command to replace with \n``

if (opts.htop_fix) //a little dirty ...
{
    elem=parseInsert(buffer);
    pelem second=elem->next;
    if (second==NULL)
	    second=elem;
    newline=second->digit[0]-1;
    if (second->digitcount>1)
	    newline=(newline+1)*10+second->digit[1]-1;
    if (second->digitcount>2)
	    newline=(newline+1)*10+second->digit[2]-1;
    deleteParse(elem);
    if (newline<line)
	    opts.line_break=1;
}

Italics support

Italic ansi codes don't seem to be applied into the html render.

"cat" of ANSI Color preserved file ends up w/o color

I created a capture file of ANSI colors of a session of ffmpeg, see attached ansible-output.txt.

Then:

cat ansible-output.txt |aha >aha_out.htm

the file aha_out.htm is just black and white.
Is something getting lost in the "cat" command? Is there a way to push saved ANSI encoded content through aha?

Inject javascript?

Nice project, I'm using it for some logs)

It would be cool if the user could inject javascript into the header, or body. I'd like my logs to be able to scroll to the bottom.

--line-fix leads to double-spaced output

Using aha commit 5eaec96, and this input file:

aha by itself gives correct output, but aha --line-fix gives output like

Script started on 2022-03-21 12:55:00-0400
host:/tmp/lstest$ ls -1                                                         

apple                                                                           

banana                                                                          

canteloupe/                                                                     

durian                                                                          

enchilada                                                                       

host:/tmp/lstest$ exit                                                          


Script done on 2022-03-21 12:55:03-0400

Adding the --ignore-cr option does not help.

This input file is intended as a minimal example. --line-fix is not needed to process it correctly, but I have more complex inputs that do require this option, and likewise get the double-spaced lines.

error: Namespace package problem: aha is a namespace package

When I try to install aha in windows machine found the below error, Does anyone found the same?

Using cached https://files.pythonhosted.org/packages/95/61/6076ed4ce338fb124ad5ed2d2300b0464fe73aeb59237c21c12284c9479c/aha-0.85adev.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'd:\virtual\ssl_test\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\AAUGUS~1\\AppData\\Local\\Temp\\pip-install-tv1qchjq\\aha\\setup.py'"'"'; __file__='"'"'C:\\Users\\AAUGUS~1\\AppData\\Local\\Temp\\pip-install-tv1qchjq\\aha\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: C:\Users\AAUGUS~1\AppData\Local\Temp\pip-install-tv1qchjq\aha\
    Complete output (14 lines):
    running egg_info
    creating pip-egg-info\aha.egg-info
    writing namespace_packages to pip-egg-info\aha.egg-info\namespace_packages.txt
    writing top-level names to pip-egg-info\aha.egg-info\top_level.txt
    writing dependency_links to pip-egg-info\aha.egg-info\dependency_links.txt
    writing requirements to pip-egg-info\aha.egg-info\requires.txt
    writing pip-egg-info\aha.egg-info\PKG-INFO
    writing manifest file 'pip-egg-info\aha.egg-info\SOURCES.txt'
    d:\virtual\ssl_test\lib\site-packages\setuptools\dist.py:474: UserWarning: Normalizing '0.85a' to '0.85a0'
      normalized_version,
    error: Namespace package problem: aha is a namespace package, but its
    __init__.py does not call declare_namespace()! Please fix it.
    (See the setuptools manual under "Namespace Packages" for details.)
    "
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Bold doesn't appear to reset

Issue: In my terminal, the output of my npm run has only 1 word in bold. The output in my html file after running aha has all the following words in bold as well.

see dump of files here: https://gist.github.com/eanderson4/807cc5dc676e8be291863c0bc043aa33

I run the following command to keep the ansi escape characters in a log.

$ unbuffer npm start > npm.log
$ cat npm.log | ./aha > npm.html

In the terminal, only 'Access URLs:' appears to be bold. However, in the html file, every word that follows is in bold. I don't really know much about these ansi characters to debug anything so I was wondering if there is any obvious mistake I was making in this.

$ ./aha --version
Ansi Html Adapter Version 0.4.10.3

And thank you for this program, it is very useful! Much appreciated.

Eric

aha seems to escape it's own generated html

input file gdb.txt

command:

aha --title "PHP core dump backtrace" --word-wrap -f gdb.txt > gdb_color.html

part of output (browser)

#1  0x00005603b6cfddc7 in strx_printv (ccp=0x7ffd455f2964, buf=0x5603b94ba6f0 "P\227K\271\003V", 
    len=1, 
    format=0x7f0586f798a8 "<tr><th align='left' bgcolor='#f57900' colspan=\"5\"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> %s: %s in %s on line <i>%d</i></th></tr>\n", ap=0x7ffd455f29a0) at /php-7.4.4/main/snprintf.c:1239

part of output (source)

#1  <span style="color:blue;">0x00005603b6cfddc7</span> in <span style="color:olive;">strx_printv</span> (<span style="color:teal;">ccp</span>=0x7ffd455f2964, <span style="color:teal;">buf</span>=0x5603b94ba6f0 &quot;P\227K\271\003V&quot;, 
    <span style="color:teal;">len</span>=1, 
    <span style="color:teal;">format</span>=0x7f0586f798a8 &quot;&lt;tr&gt;&lt;th align='left' bgcolor='#f57900' colspan=\&quot;5\&quot;&gt;&lt;span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'&gt;( ! )&lt;/span&gt; %s: %s in %s on line &lt;i&gt;%d&lt;/i&gt;&lt;/th&gt;&lt;/tr&gt;\n&quot;, <span style="color:teal;">ap</span>=0x7ffd455f29a0) at <span style="color:green;">/php-7.4.4/main/snprintf.c</span>:1239

Feature request: Process CR characters to match final terminal output

I am using the script(1) command to record terminal sessions. aha handles the output files well, but for one issue: programs which use \r repeatedly to update the current output line. This results in numerous repeated lines in the aha output, along with the raw CR characters.

Here is a sample file produced by script(1), in which I invoke apt-get(8). If you view this file in less(1), the CR characters and their associated text are clearly visible.

Here is a straight copy-and-paste from the terminal after the above command was run. The desired processing would produce text of this form (aside from the color, of course).

Being able to process script(1)-generated files cleanly would be a useful feature, as these often capture ANSI escape sequences, and removing the CR characters without munging up the colors is nontrivial with standard Unix tools.

not capturing text background color

I don't know much about how ANSI colors work, so forgive my ignorance here.

I'm trying to save colorized git diff output to HTML, but am having an issue where the background colors aren't appearing in the HTML. Running the following command:

git diff -w --color old.txt new.txt | aha --black > diff.html

Terminal output:

screen shot 2017-04-07 at 1 48 44 pm

Rendered Aha HTML:

screen shot 2017-04-07 at 1 49 06 pm

I tried ansifilter as well and had the same problem, so I wonder if it might be something weird with how diff-highlight does background colors or something?
Potentially-relevant lines from my .gitconfig:

[color]
        ui = true
[pager]
        diff = diff-highlight | less

and software versions:

$ aha --version
Ansi Html Adapter Version 0.4.10.6
$ git --version
git version 2.12.2
hub version 2.2.9

Tested using ZSH on iTerm and Terminal. Awesome project, thanks!

Trying to get in touch regarding a security issue

Hey there!

I'd like to report a security issue but cannot find contact instructions on your repository.

If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

Thank you for your consideration, and I look forward to hearing from you!

(cc @huntr-helper)

output of shell code highlighter seems empty because of wrong colors

I use the command line tool rougify of the ruby highlighting lib https://github.com/jneen/rouge to color text files that I want to save later as html.

Minimal example:

echo "{'a': 14}" | rougify highlight -l js | aha --title "rougify test"     

Unfortunately, the output seems empty, because the colors are wrongly set. The output from above is:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- This file was created with the aha Ansi HTML Adapter. https://github.com/theZiz/aha -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8" />
<title>rougify test</title>
</head>
<body>
<pre>
<span style="color:white;text-decoration:blink;">{</span><span style="color:black;text-decoration:blink;"></span><span style="color:white;font-weight:bold;text-decoration:blink;">'a'</span><span style="color:white;text-decoration:blink;">:</span><span style="color:black;text-decoration:blink;"></span><span style="color:white;text-decoration:blink;"> </span><span style="color:black;text-decoration:blink;"></span><span style="color:white;font-weight:bold;text-decoration:blink;">14</span><span style="color:white;text-decoration:blink;">}</span><span style="color:black;text-decoration:blink;"></span><span style="color:white;text-decoration:blink;"></span><span style="color:black;text-decoration:blink;">
</span><span style="color:white;text-decoration:blink;"></span><span style="color:black;text-decoration:blink;"></span>
</pre>
</body>
</html>

Note that the color is only black and white. In the browser Firefox, the file seems to be empty.

Please add licence files

Relating to #14. Can you just add files called "LICENSE" or "COPYING" with the text of the licences that you want to use? Please use one file for each license.

contribution: convert aha's html output to github-compatible html

i made a wrapper script, to convert aha's html output to github-compatible html

https://github.com/milahu/random/blob/master/colors-to-github.sh

on github, we need <pre><span color="red">red</span></pre> etc

demo:

colors-to-github.sh jp2a 'awesome face.png'

                                
         .;ldkO00Okdl;.         
      .o0XXXXXXXXXXXXXX0o.      
    .kKKXXXXXXXXXXXXKKXXXXk'    
   ::dk: :0XXXXXXdcdkd.'xXXXo   
  o.NMMc ..KXXXX:dMMM0...dXXXd  
 'O,MMMMMM;kXXXX.MMMMMMMX'XXXX, 
 oXloooooolKXXXXoooooooolxXXXXd 
 oXKkkkkkkkkkkkkkkkkkkkkkXXXXXo 
 'XKk .................. dXXXX, 
  oXXc...................lXXXd  
   lXX:.......':lolc,....KXXo   
    .kXx....'oKKKKKKKc.cKXk'    
      .l0kc,;oxxdolccxK0o.      
          .cdxxxkkkdc'          
                                

Feature request: Ignore xterm alternate screen

When I record terminal sessions using script(1), on occasion a full-screen ncurses-style dialog will pop up. This results in a big mess in the recorded session, with a large number of escapes for colors, cursor positioning, etc. However, none of that needs to be reflected in the final output, if all you want to see is the normal terminal buffer.

This file is a simple example. It is a terminal session recorded with script(1), in which I invoke a command dpkg-reconfigure tzdata that pops up an ncurses dialog. You can see the mess of escapes in the file, after the command is entered. I even navigated around the dialog a bit, just to make the mess even worse.

However, once I exit the dialog, the terminal looks like this:

root@xubuntu:/tmp# script typescript-dialog.txt 
Script started, output log file is 'typescript-dialog.txt'.
root@xubuntu:/tmp# 
root@xubuntu:/tmp# dpkg-reconfigure tzdata

Current default time zone: 'Etc/UTC'
Local time is now:      Mon Mar 21 17:21:29 UTC 2022.
Universal Time is now:  Mon Mar 21 17:21:29 UTC 2022.

root@xubuntu:/tmp# 
root@xubuntu:/tmp# 
exit
Script done.
root@xubuntu:/tmp# 

The dialog screens are no longer present in the terminal buffer, even if I scroll up. That is because the entire dialog interaction took place in the terminal's "alternative screen buffer," which is separate from the normal buffer. The normal buffer is what I would want to see in the final HTML output.

As documented here, the alternative screen buffer is enabled by ESC[?1049h, and disabled by ESC[?1049l. All that would be needed is to ignore everything between these two escapes.

(This could be made optional, but given that the alternative screen buffer is typically used by full-screen text UIs that aha can't meaningfully handle anyway, I don't think that anyone would want to turn it off.)

Buffering, and blocking

Apparently, by default, in the terminal, it makes a program line-buffered, whereas outside that it is fully buffered.

aha you can just type and immediately see output, whereas aha | cat, you do not.

This led to some confusion when i was trying to re-use a few piped programs to reduce overhead by inserting a pattern i'd recognize and stop reading at, but the stream just blocked. (Here is a bit of discussion about that.) eklitzke.org/stdout-buffering indicates some other ways it could give people some trouble. @zseri also provides a command stdbuf -o L aha to avoid this issue.

I am not sure if it is the aha-program's responsibility. See that, for instance, bat syntax highlighting disables buffering entirely, seems to me that efficiency does kindah matter. Based on what zseri says setvbuf(stream, NULL, _IOLBF, 0); disables it setlinebuf makes it line-buffered. I don't think this complexity will bite users/devs in the ass, since it's just setting about the stream?

Everything in single line

For some things passed to aha I get everything printed in a single line in the HTML where I would like the new lines to be printed. Am I missing something obvious?

$ df -l | aha
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- This file was created with the aha Ansi HTML Adapter. https://github.com/theZiz/aha -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8" />
<title>stdin</title>
</head>
<body>
<pre>
Filesystem     1K-blocks      Used Available Use% Mounted on
udev             2987924         0   2987924   0% /dev
tmpfs             603800      1768    602032   1% /run
/dev/sdb5      278083628  16868800 247019272   7% /
tmpfs            3018988        20   3018968   1% /dev/shm
tmpfs               5120         4      5116   1% /run/lock
tmpfs            3018988         0   3018988   0% /sys/fs/cgroup
/dev/loop7         14848     14848         0 100% /snap/gnome-logs/37
/dev/loop1         35584     35584         0 100% /snap/gtk-common-themes/319
/dev/loop0         13312     13312         0 100% /snap/gnome-characters/103
/dev/loop3        144384    144384         0 100% /snap/gnome-3-26-1604/70
/dev/loop5          2304      2304         0 100% /snap/gnome-calculator/260
/dev/loop2          3840      3840         0 100% /snap/gnome-system-monitor/51
/dev/loop6         14976     14976         0 100% /snap/gnome-logs/45
/dev/loop8         13312     13312         0 100% /snap/gnome-characters/139
/dev/loop10        35456     35456         0 100% /snap/gtk-common-themes/818
/dev/loop9         90368     90368         0 100% /snap/core/5897
/dev/loop12        89984     89984         0 100% /snap/core/5742
/dev/loop13         3840      3840         0 100% /snap/gnome-system-monitor/57
/dev/loop14        89088     89088         0 100% /snap/core/4917
/dev/loop4          2432      2432         0 100% /snap/gnome-calculator/180
/dev/loop11       144128    144128         0 100% /snap/gnome-3-26-1604/74
/dev/sdc2      732470268 257415360 475054908  36% /media/sys-storage
/dev/sdb1      201454560  75544748 115653432  40% /media/lin-storage
tmpfs             603796         4    603792   1% /run/user/1000
tmpfs             603796        12    603784   1% /run/user/121
</pre>
</body>
</html>

Overlapping highlight and foreground colour

When given a character whose highlight and text colour match, the terminal will render text using its background colour (essentially 'punching through' the highlight).

aha, however, renders the text in its own highlight colour -- resulting in a solid block in the HTML output, whose text can only be read by block-selecting it.

When text and highlight colour match, aha should therefore render text in the chosen/specified terminal background colour, as opposed to the ANSI colour currently in use.

It would be nice if `aha` could render URLs as `a href`

Choose a different font for the output

Is there any way to specify a different (monospace) font for the HTML output? To get the output HTML in the font SF Mono, for example, I tried:

... | aha -y 'font-family: "SF Mono"'

, but the HTML output is still in what looks like Courier. Disclaimer: I don't really know CSS.

Processing Backspaces Instead of Throwing Them Out

It would be nice if AHA could process backspaces found in the text instead of just throwing them out as it seems to currently be doing. I'm using the program to pretty-print scripts my students have prepared with either their own or GCC's ANSI coloring in them. (That is a typescript from the script program.) They regularly backspace while scripting and/or use the arrows to scroll through their command history. The results I've seen so far look like such codes are just being thrown out. Could you please process them?

Using filter: instead of 2 sets of colors is broken (v0.5.1)

Your filter can't distinguish between foreground and background colors. So you can't render bright fg with normal bg or vice-versa.

With my Perl One Liner pl I give an example for generating a table of all combinations and the numbers that create them.
If you run that command snippet in a terminal, you get this output ansi-table.txt (which you can cat if you don't want to download & run pl). But if you hover it with your mouse, you see what aha -n makes of it: In the "fg;" column you still see the contrast between color-pairs. But in all following columns, with a bg-color added, they become the same.

On a lesser note, you create a rather redundant amount of <span> and style. E.g. in the above example, the fg stays the same for the rest of the line. So you could set it once in an outer <span>.

Similarly this alternates between red & green several times. You can see that I have adapted your output. I put the 1st color into an outer <span> and nest the other color, saving quite a bit of html.

Thirdly, in this last example you also see how replacing the styles with my predefined classes makes it even more compact and readable. Here I didn't need it, but html would allow, e.g. class='red bright-green-bg'.

Write color in rgb?

Hi,

not sure if this is possible at all, but could aha query the current rgb-mapping of, for example, the color green and insert this value instead of the name into the html?

Greetings

Add tests to the repo

Looking at .gitignore, there's this line:

/testcases/*

which hints that some tests have been written for the program, but are excluded from the repository.

It would be useful to have these tests as part of the repo.

  1. It would make contributing easier, as it'd provide a way to check against regressions.
  2. It would allow third-party redistributors (e.g. Linux distro packagers) to verify that the program runs as intended.

using aha with "tee" command.

is it possible to use aha with "tee"
I want to display the output of my command on the console as well as pipe it using "aha" to an html file

[Help] How do I view output on terminal too?

Great work. Is there any way I could view output in terminal and get the htm simultaneously? I am doing android builds and these are very long and it'll be great if we can have output on terminal as well as an htm

CSS option

Would be cool if there's a way to specify a css file to use.

Something like --css=style.css

And then it just injects the tag into the header.

I could just do it with extra commands, but it would be easier this way.

Or at least some style options like font size.

Can't get terminal table characters to show correctly in the output

I have a script that generates pretty terminal tables that I'd like to convert to HTML using AHA.
The output in the console looks like this:
image

But once it has been parsed by aha it looks like this:
image

The bars/lines are all messed up. I have encountered a very similar issue with tmux in the past, where the problem was that tmux was showing these characters instead of pretty tables but can be solved by forcing tmux in unicode mode with -u flag.
Is there something similar I could use for this ?

If it makes any difference I'm using aha through pipes, like this:

data=$(./status.py $@)
echo -e "$data" | aha

an unwanted character is added after bold

Compiled from ea38baa

$ echo $( tput bold )"foo"$( tput sgr0 )"bar" | ~/aha/aha 
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- This file was created with the aha Ansi HTML Adapter. https://github.com/theZiz/aha -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8" />
<title>stdin</title>
</head>
<body>
<pre>
<span style="font-weight:bold;">fooB</span>bar
</pre>
</body>
</html>

(There's a B after foo)

readme

Have readme explain what aha does.

Does `aha` support 256 colors?

Hello. A look at the code doesn't seem to indicate that aha actually supports xterm's 256 colors, so I'll ask it explicitly: Does aha support 256 colors?

New release?

Since recently there's been quite a lot of new features introduced, I think it'd be great to bump the version number and have a new release.

Image: Positive (27) doesn't cancel out Image: Negative (7) correctly

I've trying to use aha with output generated by:

file1:
this is a test

file2:
this is also a test

diff -u file1 file2 | diff-highlight | aha > diff.html

This results in the end of line 1 (and line 2) being a weird background color. I expect a white background (no background color overridden), but it's gray instead.

It looks like the ^[27m isn't cancelling the ^[7m correctly.

diff-highlight can be found at git/contrib/diff-highlight

Problem with PHP

I use aha in PHP code for colorize output.
But output text not ok. why?

exec("inxi -c 2 | aha -n > inxi.html", $returnOut, $stdout);
�12CPU� Quad Core AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx (-MT MCP-) �
�12speed/min/max� 2762/1400/2100 MHz �12Kernel� 5.13.0-40-generic x86_64 �12Up� 8h 15m �
�12Mem� 14955.5/15704.2 MiB (95.2%) �12Storage� 464.97 GiB (18.7% used) �12Procs� 660 �
�12Client� Unknown Client: php7.2 �12inxi� 3.3.06 �

New release

Since the last release has happened ~2 years ago and some fixes have been merged, would it be possible to get a new release (i.e. version)?. This would be immensely helpful to distro packagers, so we don't have to patch the 0.5.1 release.

aha: Buffer overflow in main function at aha.c:973 in aha 0.5.1 allows remote attackers to cause a denial of service (crash) via a crafted input document.

root@fuzz06:/home/fuzz/fuzz/aha-master# gdb --args ./aha -f out/fuzzer1/crashes/poc.txt
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./aha...
(gdb) r
Starting program: /home/fuzz/fuzz/aha-master/aha -f out/fuzzer1/crashes/poc.txt

<title>out/fuzzer1/crashes/poc.txt</title>

Program received signal SIGSEGV, Segmentation fault.
0x000055555555dc2b in main (argc=3, args=0x7fffffffe598) at aha.c:973
973 momelem=momelem->next;
(gdb) bt
#0 0x000055555555dc2b in main (argc=3, args=0x7fffffffe598) at aha.c:973
(gdb) l
968 state.highlighted = 1;
969 *dest=momelem->value-100;
970 }
971 break;
972 }
973 momelem=momelem->next;
974 }
975 deleteParse(elem);
976 break;
977 case 'H':
(gdb) n

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.

poc.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.