f



How to create a file named "\a" and "-a"

Hi !How to create a file named "\a" and "-a"?

0
jdxyw2004 (126)
3/16/2007 2:36:01 PM
comp.os.linux.misc 33599 articles. 1 followers. amosa69 (78) is leader. Post Follow

16 Replies
688 Views

Similar Articles

[PageSpeed] 25

dolphin wrote:
> Hi !How to create a file named "\a" and "-a"?
> 
"touch \\a" nets you "\a"


making  "-a" filename is harder..

You may have to resort to C code..

Its pretty hard to get the standard tools to ignore what they interpret
as switches.
0
The
3/16/2007 2:48:23 PM
On 16 Mar 2007 at 14:36, dolphin wrote:
> Hi !How to create a file named "\a"

touch '\a'

> and "-a"?

touch -- -a
(assuming GNU touch)

-- 
email: echo t.adllkhsl@iypzavs.hj.br | tr a-gh-pq-z t-za-ij-s
0
seesig3 (46)
3/16/2007 2:51:34 PM
On Fri, 16 Mar 2007 14:48:23 +0000, The Natural Philosopher <a@b.c> wrote:
> dolphin wrote:
>> Hi !How to create a file named "\a" and "-a"?
>> 
> "touch \\a" nets you "\a"
>
>
> making  "-a" filename is harder..
>
> You may have to resort to C code..

touch ./-a 

> Its pretty hard to get the standard tools to ignore what they interpret
> as switches.
0
Ignoramus12697
3/16/2007 2:58:00 PM
On 3=D4=C216=C8=D5, =CF=C2=CE=E710=CA=B148=B7=D6, The Natural Philosopher <=
a=2E..@b.c> wrote:
> dolphin wrote:
> > Hi !How to create a file named "\a" and "-a"?
>
> "touch \\a" nets you "\a"
>
> making  "-a" filename is harder..
>
> You may have to resort to C code..
>
> Its pretty hard to get the standard tools to ignore what they interpret
> as switches.

Thanks very much!

0
jdxyw2004 (126)
3/16/2007 2:58:34 PM
Ignoramus12697 wrote:
> On Fri, 16 Mar 2007 14:48:23 +0000, The Natural Philosopher <a@b.c> wrote:
>> dolphin wrote:
>>> Hi !How to create a file named "\a" and "-a"?
>>>
>> "touch \\a" nets you "\a"
>>
>>
>> making  "-a" filename is harder..
>>
>> You may have to resort to C code..
> 
> touch ./-a 
> 

Ah..never thought of that. Good one!

>> Its pretty hard to get the standard tools to ignore what they interpret
>> as switches.
0
The
3/16/2007 3:16:12 PM
On 2007-03-16, Ignoramus12697 <ignoramus12697@NOSPAM.12697.invalid> wrote:
>> making  "-a" filename is harder..
>>
> touch ./-a 

or touch -- -a

>> Its pretty hard to get the standard tools to ignore what they interpret
>> as switches.

Standard tools have standard way to tell them that wathever follow ain't
a switch anymore.

Davide

-- 
Politics is the art of looking for trouble, finding it everywhere, diagnosing 
it incorrectly, and applying the wrong remedies.
-- Julius Henry "Groucho" Marx (http://en.wikiquote.org/wiki/Groucho_Marx)
0
3/16/2007 3:20:35 PM
dolphin wrote:
> Hi !How to create a file named "\a" and "-a"?
> 
Are you trying to make a pest of yourself?

Imagine the nuisance if you wish to actually use such a file.
Imagine if an innocent user uses -a as an argument and your file is used as
a file? It might be a good way to spread viruses around or get root
permission. I have not figured out how to do it, but it is very suspect.

-- 
  .~.  Jean-David Beyer          Registered Linux User 85642.
  /V\  PGP-Key: 9A2FC99A         Registered Machine   241939.
 /( )\ Shrewsbury, New Jersey    http://counter.li.org
 ^^-^^ 12:45:01 up 28 days, 10 min, 4 users, load average: 4.26, 4.17, 4.15
0
jeandavid8 (983)
3/16/2007 4:48:14 PM
Jean-David Beyer staggered into the Black Sun and said:
> dolphin wrote:
>> How to create a file named "\a" and "-a"?
> Are you trying to make a pest of yourself?  Imagine the nuisance if
> you wish to actually use such a file.

Ain't no thing, with -- -a and/or ./-a , as others have shown.

> Imagine if an innocent user uses -a as an argument and your file is
> used as a file?

"Aliases make everything safe!  We've aliased rm to 'rm -i' for
everyone, so they won't have a problem!"
"touch ./-rf && rm *"

....that might be a problem, but it doesn't tend to come up much in
actual practice.

> I have not figured out how to [use weirdly-named files for privilege
> escalation or other attacks], but it is very suspect.

Actually, it sounds like a homework question for Unix-Like OSes 101 to
me, but whatever.  Knowing the -- and ./ bits of info and how to escape
chars in the shell are just more tools in a knowledgable user's toolbox.

-- 
  "Bother," said Pooh.  "Eeyore, ready two photon torpedoes and lock
  phasers on the Heffalump; Piglet, meet me in transporter room three."
     --Robert Billing
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
0
3/16/2007 5:08:02 PM
On Fri, 16 Mar 2007, Jean-David Beyer wrote:

> dolphin wrote:
>> Hi !How to create a file named "\a" and "-a"?
>>
> Are you trying to make a pest of yourself?
>
> Imagine the nuisance if you wish to actually use such a file.
> Imagine if an innocent user uses -a as an argument and your file is used as
> a file? It might be a good way to spread viruses around or get root
> permission. I have not figured out how to do it, but it is very suspect.
>
>

Reminds me of a friend who once tried to remove a directory with a strange 
character and accidentally rm -rf /'d the whole thing.

-- 
Sir Jackery
0
roehrig (29)
3/16/2007 5:21:49 PM
How about creating files such as filename "-rf ..", etc... that would
be even more fun...

i

On Fri, 16 Mar 2007 16:48:14 GMT, Jean-David Beyer <jeandavid8@verizon.net> wrote:
> dolphin wrote:
>> Hi !How to create a file named "\a" and "-a"?
>> 
> Are you trying to make a pest of yourself?
>
> Imagine the nuisance if you wish to actually use such a file.
> Imagine if an innocent user uses -a as an argument and your file is used as
> a file? It might be a good way to spread viruses around or get root
> permission. I have not figured out how to do it, but it is very suspect.
>
0
Ignoramus12697
3/16/2007 5:27:09 PM
On 2007-03-16, Dances With Crows wrote:
> Jean-David Beyer staggered into the Black Sun and said:
>> dolphin wrote:
>>> How to create a file named "\a" and "-a"?
>> Are you trying to make a pest of yourself?  Imagine the nuisance if
>> you wish to actually use such a file.
>
> Ain't no thing, with -- -a and/or ./-a , as others have shown.

   It will potentially break many scripts. There are ways around it,
   but often people do not write robust scripts to handle such cases.

   The POSIX standard defines a Portable Filename Character Set that
   is guaranteed to to be portable across POSIX systems. Modern Unix
   systems are largely POSIX compliant, and this character set, which
   comprises the 52 upper- and lower-case letters, the 10 digits, and
   the period, hyphen, and underscore, is safe on all such systems (as
   well as most older ones). Portable filenames may not begin with a
   hyphen.

   To be safe, use portable file names.

>> Imagine if an innocent user uses -a as an argument and your file is
>> used as a file?
>
> "Aliases make everything safe!  We've aliased rm to 'rm -i' for
> everyone, so they won't have a problem!"
> "touch ./-rf && rm *"
>
> ...that might be a problem, but it doesn't tend to come up much in
> actual practice.

   Redefining standard commands is probably the most dangerous thing
   you can do, especially with aliases. 


-- 
   Chris F.A. Johnson, author   |    <http://cfaj.freeshell.org>
   Shell Scripting Recipes:     |  My code in this post, if any,
   A Problem-Solution Approach  |         is released under the
   2005, Apress                 |    GNU General Public Licence
0
cfajohnson (1827)
3/16/2007 5:40:20 PM
In news:1174056445.43677.0@iris.uk.clara.net,
The Natural Philosopher <a@b.c> wrote:

> making  "-a" filename is harder..
> 
> You may have to resort to C code..
> 
> Its pretty hard to get the standard tools to ignore what they
> interpret as switches.

Use the same convention as in other commands:

    touch -- -a
0
ynotssor (750)
3/16/2007 8:55:02 PM
The Natural Philosopher wrote:
> dolphin wrote:
>
>> Hi !How to create a file named "\a" and "-a"?
>
> "touch \\a" nets you "\a"
> 
> making  "-a" filename is harder..

How about "touch ./-".

-- 
Chuck F (cbfalconer at maineline dot net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>



-- 
Posted via a free Usenet account from http://www.teranews.com

0
cbfalconer (19194)
3/17/2007 1:54:07 AM
On Mar 16, 10:48 am, The Natural Philosopher <a...@b.c> wrote:
> dolphin wrote:
> > Hi !How to create a file named "\a" and "-a"?
>
> "touch \\a" nets you "\a"
>
> making  "-a" filename is harder..
>
> You may have to resort to C code..

No, you wont

> Its pretty hard to get the standard tools to ignore what they interpret
> as switches.

On the contrary, it is trivially easy

touch ./-a
rm ./-a

HTH
--
Lew

0
lpitcher (688)
3/17/2007 4:12:48 AM
"DWC" == Dances With Crows <danSPANceswithTRAPcrows@gmail.com>:
DWC> "Aliases make everything safe!  We've aliased rm to 'rm -i' for
DWC> everyone, so they won't have a problem!"
DWC> "touch ./-rf && rm *"

If ./-rf does not exist,

  touch ./-i 

might help someone who is a little careless with 'rm *'...

0
nobody24 (113)
3/17/2007 5:46:58 AM
Anonymous <nobody@mixmin.net> writes:

>"DWC" == Dances With Crows <danSPANceswithTRAPcrows@gmail.com>:
>DWC> "Aliases make everything safe!  We've aliased rm to 'rm -i' for
>DWC> everyone, so they won't have a problem!"
>DWC> "touch ./-rf && rm *"

>If ./-rf does not exist,

>  touch ./-i 

>might help someone who is a little careless with 'rm *'...

or
touch -- -a
rm -- -a

0
unruh-spam (2990)
3/17/2007 5:56:00 AM
Reply: