Well... no. Can't write up the code for ya. Too much of a chore.
It's pretty straightforward stuff, but it's also sensitive to details. You have to get the correct sign on a bunch of trig functions, and the code is different depending on what order you do your rotations in. It's always a minor headache to write one of these things, and I haven't quite got it in me right now.
But I'm sure you can find some reference material by searching the web for some combination of "euler", "conversion", "trig", "transformation" and "matrix".
here's an example:
http://www.geocities.com/siliconvalley/hor...33/3d.html#math
The section labeled "Transformation" describes a point-rotation routine similar to what you're asking. To get a forward vector (Z), you'd just feed it "0,0,1" as input.
But of course, order of rotations affects everything. I don't know offhand if this guy's code is written for heading->pitch->bank (ZXY; the order I think in) or XYZ; maya's default. And I'm too tired at the moment to sort it out. In any case, objects in maya can have any order of rotation, so for your function to be really useful in maya, it would have to be able to solve for different orders of rotation (perhaps by taking the order as an argument).
So it's a fair amount of work. Good practice though.
Anyway to get a rotation from a vector, you basically have to go through the order of rotation backwards, and use arcfunctions.
Keep in mind that when you go from a set of eulers to a forward vector and back, you lose one axis worth of information. You can be right side up or upside down, and still be facing towards the same "forward" point; a target on its own can't describe rotation around the aiming axis.
There are ways of packing a complete orientation into a 3-value vector, but those vectors don't correspond to major axes of the object. For example, you could call your three euler values a vector. It's a legitimate vector; there just aren't any benefits to thinking of it that way. Euler values don't behave in any way that's amenable to vector math.
Alternately, you can make a vector that describes an arbitrary axis of rotation, and have the magnitude of the vector represent the amount of rotation around that axis. That method is probably the most elegant way to describe a rotation; it fits everything into three numbers, and it does have some useful functionality as a vector; it can be used to sum up torques in a physics simulation.
But no matter what path you take, it's going to be a fair amount of work unfortunately.